
** PHONEDEX.CMD VER 1.0

* SET VARIABLES
SET talk OFF
SET colon OFF
STORE t TO fun
* PRIMARY LOOP
DO WHILE fun
* SELECT DATABASE AND INDEX
USE NAMES
USE NAMES INDEX LAST
* ESTABLISH SCREEN DISPLAY AND ACTION VARIABLES
  STORE 'F)OREWARD 1 RECORD     S)EARCH FOR ANOTHER NAME;
     E)NTER NEW RECORD' TO PROMPT1
  STORE 'B)ACKWARD 1 RECORD     K)EYWORD SEARCH         ;
     D)ELETE/EDIT RECORDS' TO PROMPT2
  STORE 'Q)UIT TO CP/M                                  ;
     A)DDRESS LABELS' TO PROMPT3
STORE CHR(31) TO B
STORE '?' TO CHOICE
STORE '?' TO ACTION
* SAVE SCREEN DISPLAY AND ACTION VARIABLES
SAVE TO PROMPTS
STORE 'PHONEDEX' TO MODE
  ERASE
  * ASK WHAT RECORD TO SEARCH FOR
  ?
  ?
  ?
  ?
  ACCEPT 'PLEASE ENTER THE LAST NAME TO SEARCH FOR' TO NAMEM
  * TRIM AND SET RECORD POINTER
  STORE TRIM(!(namem)) TO namem
  FIND &namem
  * IF RECORD IS NOT FOUND GIVE USER INFORMATION
  * AND SOMETHING TO DO.
  IF # = 0
    ?
    ?
    ?
    ?
    ? ' THAT NAME IS NOT IN PHONEDEX'
    ?

    ? ' PRESS X TO QUIT,'
    ? ' PRESS C TO LOOK FOR ANOTHER NAME'
    WAIT TO choice
    DO CASE
    * IF USER IS TOTALLY CONFUSED AND WANTS TO QUIT.
    CASE !(choice) = 'X'
      QUIT
    * IF USER WANTS TO TAKE ANOTHER HACK AT IT.
    CASE !(choice) = 'C'
      LOOP
    * IF USER CAN'T HIT RIGHT KEY
    OTHERWISE LOOP
    ENDCASE
ENDIF
* SCREEN LOOP
DO WHILE action <> 'Q'
  * CLEAR AND PRESENT SCREEN
  ERASE
  @ 1, 0 SAY "&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B"
  @ 1,30 SAY "&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B"
  @ 1,50 SAY "&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B"
  @ 2, 0 SAY "&B"
  @ 2,36 SAY mode
  @ 2,78 SAY "&B"
  @ 3, 0 SAY "&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B"
  @ 3,30 SAY "&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B"
  @ 3,50 SAY "&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B"
  @ 4, 0 SAY "&B"
  @ 4,78 SAY "&B"
  @ 5, 0 SAY "&B"
  @ 5, 6 SAY  TRIM(FIRST) + ' ' + LAST
  @ 5,78 SAY "&B"
  @ 6, 0 SAY "&B"
  @ 6,78 SAY "&B"
  @ 7, 0 SAY "&B"
  @ 7, 6 SAY address
  @ 7,61 SAY ACODE
  @ 7,78 SAY "&B"
  @ 8, 0 SAY "&B"
  @ 8,78 SAY "&B"
  @ 9, 0 SAY "&B"
  @ 9, 6 SAY TRIM(CITY) + ', ' + STATE
  @ 9,51 SAY "HOME PHONE"
  @ 9,62 SAY phone1
  @ 9,78 SAY "&B"
  @ 10, 0 SAY "&B"
  @ 10,78 SAY "&B"
  @ 11, 0 SAY "&B"
  @ 11, 6 SAY zip
  @ 11,49 SAY "OFFICE PHONE"
  @ 11,62 SAY PHONE2
  @ 11,78 SAY "&B"
  @ 12, 0 SAY "&B"
  @ 12,78 SAY "&B"
  @ 13, 0 SAY "&B     KEYWORD"
  @ 13,14 SAY keyword
  @ 13,78 SAY "&B"
  @ 14, 0 SAY "&B"
  @ 14,78 SAY "&B"
  @ 15, 0 SAY "&B ************************************************"
  @ 15,50 SAY "*************************** &B"
  @ 16, 0 SAY "&B"
  @ 16, 3 SAY prompt1
  @ 16,78 SAY "&B"
  @ 17, 0 SAY "&B"
  @ 17, 3 SAY prompt2
  @ 17,78 SAY "&B"
  @ 18, 0 SAY "&B"
  @ 18, 3 SAY prompt3
  @ 18,78 SAY "&B"
  @ 19, 0 SAY "&B"
  @ 19,21 SAY "WHAT WOULD YOU LIKE TO DO NEXT"
  @ 19,52 GET ACTION
  @ 19,78 SAY "&B"
  @ 20, 0 SAY "&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B"
  @ 20,30 SAY "&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B"
  @ 20,50 SAY "&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B"
  READ
  DO CASE
    * move foreward 1 record
    CASE !(action) = 'F'
      SKIP
      STORE '?' TO action
      LOOP
    * move backward 1 record
    CASE !(action) = 'B'
      STORE '?' TO action
      SKIP -1
      LOOP
    * print labelS
    CASE !(action) = 'A'
      STORE '?' TO ACTION
      DO PRINT
    * EDIT OR DELETE RECORDS
    CASE !(action) = 'D'
      STORE '?' TO action
      DO EDIT
    * quit to CP/M
    CASE !(action) = 'Q'
      QUIT
    * SEARCH FOR A DIFFERENT NAME
    CASE !(action) = 'S'
      STORE 'Q' TO action
      LOOP
    * enter new records
    CASE !(ACTION) = 'E'
    STORE '?' TO ACTION
    DO ENTER
    * SEARCH BY KEYWORD
    CASE !(ACTION) = 'K'
    STORE '?' TO ACTION
    DO KEYWORD
    * IF USER SCREWS UP AND HITS SOMETHING ELSE
    OTHERWISE
    STORE '?' TO ACTION
  ENDCASE
ENDDO WHILE ACTION
ENDDO WHILE FUN


E
    STORE '?' TO ACTION
  ENDCASE
ENDDO WHILE ACTION
ENDDO WHILE FUN


S SOMETHING ELSE
    OTHERWISE
    STORE '?' TO ACTION

  ENDCASE
enddo WHILE ACTION
ENDDO WHILE FUN





 WHILE FUN





choice

    DO CASE

    CASE !(choice) = 'X'
      QUIT

    CASE !(choice) = 'C'
      LOOP

    OTHERWISE LOOP

    ENDCASE

endif
DO WHILE action <> 'Q'


  ERASE
  @ 1, 0 