home *** CD-ROM | disk | FTP | other *** search
- * Program..: PARSE.CMD
- * Author...: Tom Rettig
- * Date.....: May 5, 1983
- * Notice...: Copyright 1983 by Ashton-Tate. All rights reserved.
- * dBASE....: II, versions 2.3x, 2.4x
- * Notes....: For separating one character field containing full names into
- * two fields, one with the first name and one with the last.
- *
- * Add two fields to your .DBF file called First:name and
- * Last:name to receive the parsed names. Leave plenty of
- * room, you can always shorten them later.
- *
- ERASE
- SET TALK OFF
- @ 1,0 SAY '========================================'+;
- '========================================'
- @ 2,0 SAY '||'
- @ 2,28 SAY 'P A R S I N G N A M E S'
- @ 2,78 SAY '||'
- @ 3,0 SAY '========================================'+;
- '========================================'
- USE Anyfile
- DO WHILE .NOT. EOF
- *
- * Separate the full name at the first space...
- STORE LEN(Char:field) TO length
- STORE @(' ',Char:field) TO location
- STORE $(Char:field,1,location-1) TO mfirstname
- STORE $(Char:field,location+1,length) TO mlastname
- *
- * Display the separation...
- STORE T TO isagain
- DO WHILE isagain
- STORE '?' TO correct
- @ 10,15 SAY #
- @ 10,23 SAY ' FULL NAME :'+Char:field
- @ 12,35
- @ 12,23 SAY 'FIRST NAME :'+mfirstname
- @ 13,35
- @ 13,23 SAY ' LAST NAME :'+mlastname
- @ 16,30 SAY 'Is this correct? ' GET correct PICTURE '!'
- READ
- *
- * If the display is correct, place in the file's newly created name
- * fields, skip to the next record, and repeat...
- IF correct='Y'
- REPLACE First:name WITH mfirstname, Last:name WITH mlastname
- SKIP
- STORE F TO isagain
- ELSE
- *
- * If the display is not correct, separate at the next space and
- * loop to display again...
- STORE @(' ',TRIM(mlastname)) TO location
- IF location<>0 .AND. mlastname>' '
- STORE mfirstname+' '+$(mlastname,1,location-1) TO mfirstname
- STORE $(mlastname,location+1,length) TO mlastname
- LOOP
- ELSE
- *
- * When all the options have been tried, the operator can make
- * the entry manually and loop to display...
- STORE $(STR(0,length+1),1,length) TO mfirstname,mlastname
- @ 10,23 SAY ' FULL NAME :'+Char:field+':'
- @ 12,17 SAY 'ENTER FIRST NAME ' GET mfirstname
- @ 13,17 SAY ' ENTER LAST NAME ' GET mlastname
- READ
- LOOP
- ENDIF
- ENDIF
- ENDDO
- @ 10,35
- ENDDO
- @ 10,0
- @ 12,0
- @ 12,11 SAY '********** P A R S I N G I S C O M P L E T E **********'
- @ 13,0
- @ 16,0
- USE Anyfile
- RELEASE ALL
- SET TALK ON
- RETURN
- *
- * EOF: Parse.cmd