home *** CD-ROM | disk | FTP | other *** search
/ Software Du Jour / SoftwareDuJour.iso / BUSINESS / DBASE / DBAPG.ARC / PARSENAM.CMD < prev    next >
Encoding:
Text File  |  1985-01-08  |  2.6 KB  |  82 lines

  1. * Program..: PARSENAM.CMD
  2. * Author...: Tom Rettig
  3. * Date.....: May 5, 1983
  4. * Notice...: Copyright 1983 by Ashton-Tate.  All rights reserved.
  5. * Version..: dBASE II, versions 2.3x, 2.4x
  6. * Notes....: For separating one character field containing full 
  7. *            names into two fields, one with the first name and 
  8. *            one with the last.
  9. *
  10. SET TALK OFF
  11. ERASE
  12. @ 1,0 SAY '========================================'+;
  13.           '========================================'
  14. @ 2,0 SAY '||'
  15. @ 2,28 SAY 'P A R S I N G   N A M E S'
  16. @ 2,78 SAY '||'
  17. @ 3,0 SAY '========================================'+;
  18.           '========================================'
  19. USE Anyfile
  20. DO WHILE .NOT. EOF
  21.    *
  22.    * Separate the full name at the first space...
  23.    STORE LEN(Char:field) TO length
  24.    STORE @(' ',Char:field) TO location
  25.    STORE $(Char:field,1,location-1) TO mfirstname
  26.    STORE $(Char:field,location+1,length) TO mlastname
  27.    *
  28.    * Display the separation...
  29.    STORE T TO isagain
  30.    DO WHILE isagain
  31.       STORE '?' TO correct
  32.       @ 10,15 SAY #
  33.       @ 10,23 SAY ' FULL NAME :'+Char:field
  34.       @ 12,35
  35.       @ 12,23 SAY 'FIRST NAME :'+mfirstname
  36.       @ 13,35
  37.       @ 13,23 SAY ' LAST NAME :'+mlastname
  38.       @ 16,30 SAY 'Is this correct? ' GET correct PICTURE '!'
  39.       READ
  40.       *
  41.       * If the display is correct, place in the file's newly created name
  42.       * fields, skip to the next record, and repeat...
  43.       IF correct='Y'
  44.          REPLACE First:name WITH mfirstname, Last:name WITH mlastname
  45.          SKIP
  46.          STORE F TO isagain
  47.       ELSE
  48.          *
  49.          * If the display is not correct, separate at the next space and
  50.          * loop to display again...
  51.          STORE @(' ',TRIM(mlastname)) TO location
  52.          IF location<>0 .AND. mlastname>' '
  53.             STORE mfirstname+' '+$(mlastname,1,location-1) TO mfirstname
  54.             STORE $(mlastname,location+1,length) TO mlastname
  55.             LOOP
  56.          ELSE
  57.             *
  58.             * When all the options have been tried, the operator can make
  59.             * the entry manually and loop to display...
  60.             STORE $(STR(0,length+1),1,length) TO mfirstname,mlastname
  61.             @ 10,23 SAY ' FULL NAME :'+Char:field+':'
  62.             @ 12,17 SAY 'ENTER FIRST NAME ' GET mfirstname
  63.             @ 13,17 SAY ' ENTER LAST NAME ' GET mlastname
  64.             READ
  65.             LOOP
  66.          ENDIF
  67.       ENDIF
  68.    ENDDO
  69.    @ 10,35
  70. ENDDO
  71. @ 10,0
  72. @ 12,0
  73. @ 12,11 SAY '********** P A R S I N G   I S   C O M P L E T E **********'
  74. @ 13,0
  75. @ 16,0
  76. USE Anyfile
  77. RELEASE ALL
  78. SET TALK ON
  79. RETURN
  80. *
  81. * EOF: Parsenam.cmd
  82.