         *************  NAMETEST COMMAND FILE  **************
* Checks names in the file in USE against the Suppliers file and gives
* the operator the options of editing, adding them to the Suppliers file
* or ignoring them.  If a name is edited, it is presented again.
**********************************************************************

GO TOP
DO WHILE .NOT. EOF
   IF *
      SKIP
   ELSE
      STORE STR(#,5) TO Number
      STORE !(Name) TO Name
      ERASE
      @  4,25 SAY 'CHECKING NAMES  '
      @  6,25 SAY 'RECORD '+Number
      @  7,25 SAY Name 
      ? CHR(7)
      STORE $(Name,1,10) to Key
      SELECT SECONDARY
      USE B:Supplier INDEX B:Supplier
      FIND &Key
      STORE T TO Again
      STORE 'T' TO Decision
      IF # = 0
         DO WHILE Again   
            @  9,20 SAY 'THIS SUPPLIER NAME IS NOT IN THE SUPPLIERS FILE. '
            @ 11,20 SAY '     E to EDIT it.                                '
            @ 12,20 SAY '     A to ADD it to the SUPPLIERS file.           '
            @ 13,20 SAY '     C to CONTINUE.                               '
            ?
            WAIT TO Decision
            IF !(Decision) = 'A'
               APPEND
               SKIP-1
               REPLACE Name WITH !(Name),Address WITH !(Address),City WITH;
                  !(City)
               STORE F TO Again
            ELSE
               IF !(Decision) = 'E'
                  SELECT PRIMARY
                  EDIT &Number
                  REPLACE Name WITH !(Name)
                  SELECT SECONDARY
                  STORE F TO Again
               ELSE
                  IF !(Decision) = 'C'
                     STORE F TO Again
                  ELSE
                     STORE T TO Again
                  ENDIF C
               ENDIF E
            ENDIF A
         ENDDO
      ENDIF 0
      SELECT PRIMARY
      IF !(Decision) <> 'E'
         SKIP
      ENDIF
   ENDIF deleted
ENDDO
RELEASE All
RETURN
