home *** CD-ROM | disk | FTP | other *** search
/ Oakland CPM Archive / oakcpm.iso / sigm / vol285 / mail.prg < prev    next >
Encoding:
Text File  |  1986-12-22  |  9.9 KB  |  341 lines

  1. **    Last revision: June 17, 1986 at 19:45
  2. * main.prg
  3. * main command program of database
  4. * do display sign-on message and initialize variables
  5. DO WHIL SUBSTR(DTOC(DATE()),7,2) = '80'
  6.  CLEA
  7.  ! DATE
  8.  ! TIME
  9. ENDD
  10. DO init
  11. * set up database
  12. USE ag
  13. SET INDEX TO lastname
  14. STOR .t. TO first
  15. * set up the forever loop for this data base
  16. DO WHIL .t.
  17.  IF first
  18.   DO s_first
  19.  ENDI first
  20.  STOR .f. TO first
  21.  STOR "  OPTIONS:  <A>dd new records,   <E>dit this record,   <P>rint this record  " TO prompt1
  22.  STOR '            <S>earch by lastname or a<N>y data in file,  prepare <R>eports ' TO prompt2
  23.  STOR '            <F>orward,  <B>ackward, <D>elete/Recall, <M>aintenance, <Q>uit ' TO prompt3
  24.  STOR CDOW(DATE())+' '+CMONTH(DATE())+' '+STR(DAY(DATE()),2)+", "+STR(YEAR(DATE()),4) TO mday
  25.  STOR 'MAIN MENU' TO mode
  26.  SET COLOR TO &revvideo
  27.  @ 1,00
  28.  @ 1,01 SAY mday
  29.  @ 1,35 SAY mode
  30.  SET COLOR TO &stdvideo
  31.  IF clipper
  32.   @ 19,0, 23,79 BOX frame
  33.  ELSE
  34.   @ 19,0 TO 23,79 double
  35.  ENDI clipper
  36.  @ 20,01 SAY prompt1
  37.  @ 21,01 SAY prompt2
  38.  @ 22,01 SAY prompt3
  39.  STOR ' ' TO command
  40.  IF DELETE()
  41.   STOR 'Deleted Record' TO deleted
  42.  ELSE
  43.   STOR '              ' TO deleted
  44.  ENDI DELETED
  45.  SET COLOR TO &revvideo
  46.  @ 1,65 SAY deleted
  47.  SET COLOR TO &stdvideo
  48.  @ 3,13 SAY lastname
  49.  @ 3,58 SAY fname
  50.  @ 4,13 SAY spouse
  51.  @ 4,58 SAY mr
  52.  @ 6,13 SAY title
  53.  @ 7,13 SAY company1
  54.  @ 8,13 SAY company2
  55.  @ 9,13 SAY caddress
  56.  @ 9,58 SAY suite
  57.  @ 10,13 SAY ccity
  58.  @ 10,44 SAY cst
  59.  @ 10,58 SAY czip
  60.  @ 12,13 SAY address
  61.  @ 12,58 SAY apt
  62.  @ 13,13 SAY city
  63.  @ 13,44 SAY st
  64.  @ 13,58 SAY zip
  65.  @ 14,21 SAY ophone
  66.  @ 14,58 SAY phone
  67.  @ 15,13 SAY dear
  68.  @ 15,58 SAY send
  69.  @ 16,13 SAY cs1
  70.  @ 16,44 SAY cs2
  71.  @ 16,58 SAY update
  72.  @ 23,33 SAY 'SELECT:'
  73.  @ 23,43 GET command PICTURE '!'
  74.  READ
  75.  CLEA GETS
  76.  DO CASE
  77.  CASE command = 'A'
  78.   DO add
  79.   LOOP
  80.  CASE (command = 'B' .OR. command = ',')
  81.   SKIP -1
  82.   LOOP
  83.  CASE command = 'D'
  84.   IF DELETE()
  85.    RECA
  86.   ELSE
  87.    DELE
  88.   ENDI
  89.   LOOP
  90.  CASE command = 'E'
  91.   SET DELIMITER OFF
  92.   STOR lastname TO mlastname
  93.   STOR fname TO mfname
  94.   STOR spouse TO mspouse
  95.   STOR mr TO mmr
  96.   STOR title TO mtitle
  97.   STOR company1 TO mcompany1
  98.   STOR company2 TO mcompany2
  99.   STOR caddress TO mcaddress
  100.   STOR suite TO msuite
  101.   STOR ccity TO mccity
  102.   STOR cst TO mcst
  103.   STOR czip TO mczip
  104.   STOR address TO maddress
  105.   STOR apt TO mapt
  106.   STOR city TO mcity
  107.   STOR st TO mst
  108.   STOR zip TO mzip
  109.   STOR ophone TO mophone
  110.   STOR phone TO mphone
  111.   STOR dear TO mdear
  112.   STOR send TO msend
  113.   STOR cs1 TO mcs1
  114.   STOR cs2 TO mcs2
  115.   STOR update TO mupdate
  116. * set up screen and prompt for editing
  117.   STOR " OPTIONS: Enter the new or corrected information. Control 'Q' or 'W' to end." TO prompt4
  118.   SET COLOR TO &revvideo
  119.   @ 1,00
  120.   @ 1,01 SAY mday
  121.   @ 1,35 SAY mode
  122.   SET COLOR TO &stdvideo
  123.   @ 19,00 CLEAR
  124.   IF clipper
  125.    @ 19,0, 23,79 BOX frame
  126.   ELSE
  127.    @ 19,0 TO 23,79 double
  128.   ENDI clipper
  129.   @ 20,01 SAY prompt4
  130.   @ 3,13 GET mlastname PICTURE '!XXXXXXXXXXXXXXXXXXXXXXXX'
  131.   @ 3,58 GET mfname PICTURE '!XXXXXXXXXXXXXXXXXXX'
  132.   @ 4,13 GET mspouse
  133.   @ 4,58 GET mmr
  134.   @ 6,13 GET mtitle
  135.   @ 7,13 GET mcompany1
  136.   @ 8,13 GET mcompany2
  137.   @ 9,13 GET mcaddress
  138.   @ 9,58 GET msuite
  139.   @ 10,13 GET mccity
  140.   @ 10,44 GET mcst picture '!!'
  141.   @ 10,58 GET mczip picture '!!!!!!!!!!'
  142.   @ 12,13 GET maddress
  143.   @ 12,58 GET mapt
  144.   @ 13,13 GET mcity
  145.   @ 13,44 GET mst picture '!!'
  146.   @ 13,58 GET mzip picture '!!!!!!!!!!'
  147.   @ 14,21 GET mophone picture '(999)999-9999'
  148.   @ 14,58 GET mphone picture '(999)999-9999'
  149.   @ 15,13 GET mdear
  150.   @ 15,58 GET msend picture '!'
  151.   @ 16,13 GET mcs1 PICTURE '!'
  152.   @ 16,44 GET mcs2 PICTURE '!!!!'
  153.   @ 16,58 GET mupdate picture '99/99/99'
  154.   READ
  155.   CLEA GETS
  156. * test if there is an error
  157.   DO check
  158.   SET DELIMITER ON
  159.   STOR 'N' TO comman
  160.   @ 20,01 SAY SPACE(77)
  161.   @ 21,01 SAY SPACE(77)
  162.   @ 22,01 SAY SPACE(77)
  163.   @ 20,15 SAY 'Are there any more changes ?                        '
  164.   @ 20,48 GET comman picture '!'
  165.   READ
  166.   SET DELIMITER OFF
  167.   IF comman = 'Y'
  168.    @ 20,01 SAY SPACE(77)
  169.    @ 3,13 GET mlastname PICTURE '!XXXXXXXXXXXXXXXXXXXXXXXX'
  170.    @ 3,58 GET mfname PICTURE '!XXXXXXXXXXXXXXXXXXX'
  171.    @ 4,13 GET mspouse
  172.    @ 4,58 GET mmr
  173.    @ 6,13 GET mtitle
  174.    @ 7,13 GET mcompany1
  175.    @ 8,13 GET mcompany2
  176.    @ 9,13 GET mcaddress
  177.    @ 9,58 GET msuite
  178.    @ 10,13 GET mccity
  179.    @ 10,44 GET mcst picture '!!'
  180.    @ 10,58 GET mczip picture '!!!!!!!!!!'
  181.    @ 12,13 GET maddress
  182.    @ 12,58 GET mapt
  183.    @ 13,13 GET mcity
  184.    @ 13,44 GET mst picture '!!'
  185.    @ 13,58 GET mzip picture '!!!!!!!!!!'
  186.    @ 14,21 GET mophone picture '(999)999-9999'
  187.    @ 14,58 GET mphone picture '(999)999-9999'
  188.    @ 15,13 GET mdear
  189.    @ 15,58 GET msend picture '!'
  190.    @ 16,13 GET mcs1 PICTURE '!'
  191.    @ 16,44 GET mcs2 PICTURE '!!!!'
  192.    @ 16,58 GET mupdate picture '99/99/99'
  193. * let user enter data
  194.    READ
  195.    CLEA GETS
  196.    DO check
  197.   ENDI command = 'Y'
  198.   REPL lastname WITH mlastname, fname WITH mfname, spouse WITH mspouse, mr WITH mmr
  199.   REPL title WITH mtitle, company1 WITH mcompany1, company2 WITH mcompany2, caddress WITH mcaddress
  200.   REPL suite WITH msuite, ccity WITH mccity, cst WITH mcst, apt WITH mapt
  201.   REPL czip WITH mczip, address WITH maddress, city WITH mcity, st WITH mst
  202.   REPL zip WITH mzip, ophone WITH mophone, phone WITH mphone, dear WITH mdear
  203.   REPL send WITH msend, cs1 WITH mcs1, cs2 WITH mcs2
  204. * ask if an automatic update of the date is wanted
  205.   SET DELIMITER ON
  206.   STOR 'Y' TO comman
  207.   @ 20,01 SAY SPACE(77)
  208.   @ 21,01 SAY SPACE(77)
  209.   @ 22,01 SAY SPACE(77)
  210.   @ 20,12 SAY 'Do You want to Update to Todays Date (Y/N) ?'
  211.   @ 20,57 GET comman PICTURE '!'
  212.   READ
  213.   IF comman = 'Y'
  214.    REPL update WITH DTOC(date())
  215.   ELSE
  216.    REPL update WITH mupdate         
  217.   ENDI
  218.   LOOP
  219.  CASE (command = 'F' .OR. command = '.')
  220. * move forward one record
  221.   SKIP
  222.  CASE (command = 'H' .OR. command = '?')
  223. * display a screen full of instructions
  224.   STOR .t. TO first
  225.   CLEA
  226.   TEXT
  227.  
  228.              M A I N    M E N U   H E L P   F I L E 
  229.  
  230.       Welcome to the Attorney General's Mailing List Data Base.   I am here to
  231.       help you  - and you can call me anytime by just entering a ? mark at any 
  232.       place where this program asks for a command. 
  233.  
  234.       When you go back to the screen you will see two lines    - on top of the 
  235.       first line it says 'Main Module'    - thus, on top of the first line the 
  236.       program always tells you where you are! 
  237.  
  238.       Between the two lines we have the information you or someone else placed
  239.       in the computer. This information tells you all about a particular file.
  240.  
  241.       Below th line is the list of things you can do. To look at the next file
  242.       hit 'F' (or a period).  To go back one record - hit 'B' (or a comma). To
  243.       delete a record hit 'D' and a sign will appear at the upper left corner.
  244.       To remove the delete - hit 'D' again. Don't worry -  you cannot delete a
  245.       record just by hitting 'D'. You must run another program on the Mainten-
  246.       ance Menu.
  247.  
  248.                                     Please hit any key to continue............
  249.   ENDT
  250.   SET CONSOLE OFF
  251.   WAIT
  252.   SET CONSOLE ON
  253.   CLEA
  254.   TEXT
  255.  
  256.       To find a file by lastname - hit 'S' for search.    You can find any data
  257.       in any file using the 'N' search. To edit - select 'E'.
  258.  
  259.       To add more records you hit 'A'.   Once in add - you enter as many files
  260.       as you want one at a time, and then can index if you wish.
  261.  
  262.       To prepare Wordstar data, reports or display records hit 'R'for reports.
  263.  
  264.       To reindex, purge files, check for duplicates, etc hit 'M' for maintain. 
  265.  
  266.       If all else fails - call Steve Leon at 488-7677. In the meantime - relax 
  267.       this program is 'User Fiendly' and I am here to help you. 
  268.       ------------------------------------------------------------------------
  269.       WHATEVER YOU DO -  NEVER SHUT OFF THE MACHINE UNTIL YOU FIRST HIT 'Q' TO
  270.       TO QUIT. You must first get back to the 'C>' (called C prompt) before you 
  271.       shut the computer.........please, otherwise you will lose data!!!!
  272.       ------------------------------------------------------------------------
  273.  
  274.                            Please hit any key to return to the data base......
  275.  
  276.  
  277.   ENDT
  278.   SET CONSOLE OFF
  279.   WAIT
  280.   SET CONSOLE ON
  281.   CLEA
  282.  CASE command = 'M'
  283.   DO maintain
  284.  CASE command = 'P'
  285.   SET CONSOL OFF
  286.   SET PRINT ON
  287.   ? '     ' +  "Name: "+ mr + TRIM(fname) +' ' + lastname
  288.   ? '     ' + "Spouse: " + spouse + "Address as: " + dear
  289.   ? '     ' + "Title: " + title
  290.   ? '     ' + "Company: " + company1
  291.   ? '     ' + "       : " + company2
  292.   ? '     ' + "Address: " + caddress + "  " + suite
  293.   ? '     ' + "         " + ccity +', ' + cst + '  ' +czip
  294.   ? '     ' + "Home address: " + address + "  " + apt
  295.   ? '     ' + "              " + city +', '+  st + '  ' +zip
  296.   ? '     ' + 'Phones - office: ' + ophone + ' home: ' + phone
  297.   ? '     ' + "List:  " + cs1 + '   Code: ' + cs2
  298.   ? '     ' + "Send to office: " + send
  299.   ? '     ' + "Date update: " + update
  300.   SET PRINT OFF
  301.   SET CONSOL ON
  302.  CASE command = 'Q'
  303. * prevent sign-off message
  304.   SET CONSOLE OFF
  305.   CLEA
  306.   QUIT
  307.  CASE command = 'R'
  308.   DO report
  309.  CASE command = 'S'
  310.   SET DELIMITER ON
  311.   STOR SPACE(15) TO name
  312.   STOR RECNO() TO rec_number
  313.   @ 19,00 CLEAR
  314.   IF clipper
  315.    @ 19,0,23,79 BOX frame
  316.   ELSE
  317.    @ 19,0 TO 23,79 double
  318.   ENDI clipper
  319.   @ 20,12 SAY 'Please enter lastname  ' GET name
  320.   READ
  321.   STOR TRIM(name) TO name
  322.   STOR UPPER(name) TO name
  323.   SEEK name
  324.   IF (EOF() .OR. BOF())
  325.    @ 20,02 SAY SPACE(75)
  326.    @ 20,12 SAY name+' is not in the file'
  327.    @ 21,12 SAY 'Press RETURN to Continue'
  328.    SET CONSOLE OFF
  329.    WAIT
  330.    SET CONSOLE ON
  331.    GO rec_number
  332.   ENDI EOF()
  333.   LOOP
  334.  CASE command = 'N'
  335.   DO search1
  336.   LOOP
  337.  ENDC
  338. * loop back again
  339. ENDD
  340. 
  341.