* main.cmd 02/09/83
* main command program of database
* this is a dBASEII database we use in a number of applications
* it has been adopted to a sample ACGNJ database, and you can
* modify it further to suit your particular application. note that
* the link files has not yet been included in the menu structure.
* also note that we have not implemented all of the features
* we contemplate, so that some program features are not yet
* available. lastly, the starting point on this program was
* Adam Green 's "dBASE II User' s guide " published by Software
* Bank, 1 Faneuil Hall Marketplace, Boston, MA 02109. We highly 
* recommend that book as the best thing around to get started in
* dBASEii and suggest you may even want to start off with
* a Software Bank seminar.

* this program runs well under both cp/m and cp/m 86. to run
* under cp/m 86 just change the name of this files to main.prg.

* comments, suggestions and improvements are welcome.

* Steve Leon
* Department of Law
* 48th floor
* 2 World Trade Center
* New York, NY 10047
* (212)488-7677

* display sign-on message while initializing system
DO sign-ON.acg

* initialize variables, set up environment, use files, etc.
DO init.acg

* set up the loop
DO WHILE t
  
  * set up screen and prompts
  SET FORMAT TO SAY-rec
  STORE '<F>orward, <B>ackward, <D>elete/Recall, <H>elp' TO prompt1
  STORE '<S>earch, <E>dit, <P>rint, <R>eports, <M>aintenance' TO prompt2
  STORE '<A>dd, <C>reate WS file, <Q>uit to CP/M' TO prompt3
  STORE 'Main Menu ' TO mode
  STORE '?' TO command
  
  * find out if the current record is marked for deletion
  DO delcheck.acg 
  
  
  * show the current record, and find out what to do next
  STORE ' ' TO send
  READ
  
  
  * perform selected function
  DO CASE
      
    CASE command = 'A' 
      DO ADD.acg
      
    CASE (command = 'B' .OR. command = ',' )
      * move backwards one record
      SKIP -1
      
    CASE command = 'D' 
      * switch the current record from deleted to recalled
      DO DELETE.acg
      
    CASE command = 'E' 
      DO EDIT.acg
      
    CASE (command = 'F' .OR. command = '.' )
      * move forward one record
      SKIP
      
    CASE command = 'H' 
      DO help.acg
      
    CASE command = 'M' 
      DO maintain.acg
      
    CASE command = 'P' 
      DO PRINT.acg
      
    CASE command = 'Q' 
      * prevent sign-off message
      	SET console OFF
      ERASE
      QUIT
      
      
    CASE command = 'R' 
      DO REPORT.acg
      
    CASE command = 'S' 
      DO search.acg
      
    CASE command = 'C' 
      DO wsfile.acg
      
  ENDCASE 
  
  * loop back again
ENDDO WHILE t 

