************ DOPCPM.CMD   VER 2.43* DBASE II VERSION   ***********
** BY GARY C. AREY  1030 HOLLAND DR. GARLAND, TX 75040  7/26/84 **
** Modified for CP/M & OSBORNE 01 by JERRY BOYCE  Charlotte, NC **
SET TALK OFF
SET FORMAT TO SCREEN
CLEAR
ERASE
?  'The following .DBF files are on the default drive:'
  LIST FILES LIKE *.DBF
?
  ACCEPT 'WHAT DATABASE DO YOU WISH TO USE ' TO BB
DO WHILE T
ERASE
   @ 01,27 SAY 'DBASE II OPERATIONS MENU'
   @ 02,27 SAY '========================'
   @ 04,17 SAY 'The Current .DBF File Now In Use is :'
   @ 04,56 SAY !('&BB') PICTURE "!!!!!!!!!!!!"
   @ 08,11 SAY ' 1> List'
   @ 09,11 SAY ' 2> Browse                         <S> Save Current Data File'
   @ 10,11 SAY ' 3> Edit Record                    <I> Initialize Data File'
   @ 11,11 SAY ' 4> Search Character Field         <E> Erase Data File'
   @ 12,11 SAY ' 5> Search Numeric Field           <C> Create .DBF'
   @ 13,11 SAY ' 6> Append (Add Records)           <N> Change Database'
   @ 14,11 SAY ' 7> Mark to Delete                 <D> Delete (Pack)'
   @ 15,11 SAY ' 8> Report to Screen               <P> Report Print '
   @ 16,11 SAY ' 9> View Structure                 <F> View Files   '
   @ 17,11 SAY ' X> Exit To DBASE . Prompt         <Q> Quit to CPM  '
SET CONSOLE OFF
WAIT TO Action
SET CONSOLE ON
       IF !(Action)= '1'
         ERASE
         USE &BB
         INPUT 'BEGINNING RECORD NO. ' TO Q
         ?
   ACCEPT 'Do you want to PRINT the result?  (Y)es (N)o ' to PR
   IF !(PR) = 'Y'
   SET PRINT ON
   ENDIF
   RELEASE PR
         ERASE
         GOTO Q
         LIST FOR # >= Q
   SET PRINT OFF
          WAIT
          USE
           ELSE
             IF !(Action)= '2'
               ERASE
               USE &BB
          ? 'While BROWSING you may Return to enter and move through record.'
          ? 'Control B  moves screen right one field.      '
          ? 'Control Z  moves screen left one field.       '
          ? 'Control X  or Right Arrow moves cursor right one field.'
          ? 'Control E  or Left Arrow moves cursor left one field.'
          * ? 'PgUp and PgDn moves edit line up & down one record' Not for CP/M
          ? 'Control Q  quits without saving changes.      '
          ? 'Control W  saves changes and quits.           '
          ?
                INPUT 'BEGINNING RECORD NO. ' TO Q
                GOTO Q
               BROWSE
               USE
           ELSE
             IF !(Action)= '3'
             ERASE
             USE &BB
           ? 'While EDITING you may Return to enter record and complete Edit.'
           ? 'Control Q  quits without saving changes.'
           ? 'Control W  saves changes and quits.'
           ?
             EDIT
             USE
           ELSE
             IF !(Action)= '4'
             ERASE
ACCEPT ' Do you wish to SEARCH on (1) or (2) fields? ' to QR
  IF !(QR)= '1'
             ERASE
             USE &BB
             LIST STRUCTURE
               ?
               ACCEPT 'SEARCH FIELD ' TO SF
               ACCEPT 'SEARCH FOR   ' TO CN
    ?
    ACCEPT 'Do you want to PRINT the result?  (Y)es (N)o ' to PR
    IF !(PR)='Y'
    SET PRINT ON
    ENDIF
    RELEASE PR
             ERASE
               * Removed (!) from !('&CN') to not force upper case.
               * Now matches the macro for a two field search.
             LIST FOR '&CN'$&SF
    SET PRINT OFF
             USE
             WAIT
             ENDIF
  IF !(QR)= '2'
             ERASE
             USE &BB
             LIST STRUCTURE
             ?
             ACCEPT 'Enter Search Field 1 ' to SF
             ACCEPT 'Search for           ' to CN
             ACCEPT 'Enter Search Field 2 ' to SF2
             ACCEPT 'Search for           ' to CN2
     ?
     ACCEPT 'Do you want to PRINT the result?  (Y)es (N)o ' to PR
     IF !(PR)='Y'
     SET PRINT ON
     ENDIF
     RELEASE PR
             ERASE
             LIST FOR '&CN'$&SF .AND. '&CN2'$&SF2
   SET PRINT OFF
             USE
             WAIT
             ENDIF
           ELSE
             IF !(Action)= '5'
             ERASE
             USE &BB
             LIST STRUCTURE
               ?
               ACCEPT 'NUMERIC SEARCH FIELD ' TO NF
               INPUT  'NUMERIC AMOUNT       ' TO NN
               ACCEPT '<  =  > ' TO E
               ?
    ACCEPT 'Do you want to PRINT the result?  (Y)es (N)o ' to PR
    IF !(PR)='Y'
    SET PRINT ON
    ENDIF
    RELEASE PR
             ERASE
             LIST FOR &NF &E NN
    SET PRINT OFF
             WAIT
             USE
           ELSE
             IF !(Action)= '6'
             ERASE
            USE &BB
    ? 'In APPEND mode  Control W  quits and saves new records to disk.'
    ? '                Control Q  quits without saving new records.'
    ? '   RETURN to begin entering records.'
    WAIT
             APPEND
             USE
           ELSE
             IF !(Action)= '7'
             ERASE
             USE &BB
             ACCEPT 'RECORD NO. TO BE MARKED FOR DELETION ' TO RD
             DELETE RECORD &RD
           ?   'SELECTED RECORD WAS MARKED FOR DELETION !'
             WAIT
             ERASE
             USE
          ELSE
             IF !(Action)= 'N'
             ERASE
             RELEASE ALL
          ? 'The following .DBF files are on the default drive :'
             LIST FILES LIKE *.DBF
             ?
             ACCEPT 'ENTER NAME OF NEW DATABASE YOU WISH TO USE ' TO BB
           ELSE
             IF !(Action)='C'
             ERASE
          ? 'The following .DBF files already exist on the default drive : '
             LIST FILES LIKE *.DBF
             ? '     RETURN to begin CREATING .DBF File.'
             WAIT
             CREATE
             ERASE
           ELSE
             IF !(Action)= 'D'
             ERASE
             USE &BB
             PACK
           ?   'PACK AND DELETION COMPLETED ! '
             USE
           ELSE
             IF !(Action)= '8'
             ERASE
             USE &BB
     ? 'The following .FRM  Report Forms are on the default drive :'
        LIST FILES LIKE *.FRM
     ?
             REPORT
             WAIT
             USE
           ELSE
             IF !(Action)= 'P'
             ERASE
             USE &BB
           INPUT 'ENTER NUMBER OF COPIES TO PRINT  ' TO MNO
           ?
      ? 'The following .FRM Report Forms are on the default drive :'
         LIST FILES LIKE *.FRM
      ?
             ACCEPT 'NAME OF REPORT YOU WISH TO PRINT ' TO RF
           DO WHILE .NOT. EOF
           DO WHILE MNO > 0
           STORE MNO-1 TO MNO
             ERASE
             REPORT FORM &RF TO PRINT
           ENDDO
           ENDDO
             WAIT
             USE
           ELSE
             IF !(Action)= '9'
             ERASE
             USE &BB
             LIST STRUCTURE
             WAIT
             USE
           ELSE
             IF !(Action)= 'F'
             ERASE
          ? 'ENTER FILE SPEC to VIEW FILES on Default Drive ;'
          ?
          ? '      DBF  for Database Files'
          ? '      FRM  for Report Form Files'
          ? '      CMD  for Command Program Files'
          ? '      FMT  for Format Files'
          ? '      NDX  for Index Files'
          ? '      MEM  for Memory Files'
          ?
             ACCEPT 'ENTER FILE SPEC ' TO FS
             LIST FILES LIKE *.&FS
             WAIT
           ELSE
             IF !(Action)= 'I'
             ERASE
             USE &BB
@ 08,05 SAY "CAUTION!: (Y)es  ERASES ALL DATA in the Current Database."
@ 09,05 SAY "          (N)o   Returns to Main Menu without Erasing Records in File."
@ 11,05 SAY "If you have answered  (Y)es  you are in  Modify Structure Mode  and a   "
@ 12,05 SAY "   Control W  will return you to the Main Menu and re-write the blank file."
             MODIFY STRUCTURE
             USE
           ELSE
             IF !(Action)= 'S'
             ERASE
             USE &BB
             @ 10,0
             ACCEPT 'Enter Filename for the Save file ' to FLN
             @ 12,0
@ 12,25 SAY 'Copying to Named Data File ! '
             COPY TO &FLN
             USE
           ELSE
             IF !(Action)='E'
             ERASE
                  ? 'RETURN if you do NOT wish to Erase a File.'
                  ?
             ACCEPT 'Enter Complete File Name you wish to ERASE ! ' to ERS
             DELETE FILE &ERS
             RELEASE ERS
           ELSE
             IF !(Action)= 'Q'
             RELEASE ALL
             ERASE
             CLEAR
             QUIT
           ELSE
             IF !(Action)= 'X'
               CLEAR
             RETURN
           ENDIF
         ENDIF
       ENDIF
     ENDIF
   ENDIF
 ENDIF
   ENDIF
     ENDIF
       ENDIF
         ENDIF
           ENDIF
             ENDIF
               ENDIF
            ENDIF
          ENDIF
        ENDIF
      ENDIF
    ENDIF
  ENDIF
ENDDO
RELEASE T, ACTION
