home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Software Du Jour
/
SoftwareDuJour.iso
/
BUSINESS
/
DBASE
/
DBASII.ARC
/
NAMEBRK.PRG
< prev
next >
Wrap
Text File
|
1980-01-01
|
3KB
|
95 lines
* NAMEBRK.CMD
* (the small letter commands are for demo. running only)
set talk off
erase
@ 12,0
accept 'Name is? ' to NAME
?
?
* NAME BREAK. CMD 11-3-82 J Shea SIBAL Engineering
* A routine that allows entering a name in full, normal order but
* seperates the name on the blank into FNAME & LNAME. if there is
* no space the entered name is considered the last name (LNAME),
* if a middle initial is used it becomes part of FNAME.
* Assumption: Name enters this routine as a variable called NAME
* first trim off the trailing blanks since most name gathering is
* done in a fixed length read, or get mode.
STORE TRIM(NAME) TO NAMET
* now we get the length, this is for possible later use, not needed
* in this program. used if you wanted to eliminate spaces in a form
* letter.
STORE LEN(NAMET) TO LENGTH
* let's find the break in the words
STORE @(' ',NAMET) TO DEPTH
* we have to check if there wasn't any. if not we assume that the name
* is a last name. this is done so a FIND command can locate a name
* indexed on the last name.
IF DEPTH = 0
* no spaces therefore a single word name entered, make it the last name
STORE NAMET TO LNAME
* to take care of no first name (minimizes errors!)
STORE ' ' TO FNAME
ELSE
* we have a break and that's all we need to seperate them
STORE $(NAMET,1,DEPTH) TO FNAME
* easy huh? now we have to check the last name for a space that
* will indicate that a middle initial or name was used.
* first we isolate the remaiming letters and consider it the lastname
STORE $(NAMET,DEPTH + 1) TO LNAME
* now we look for more spaces just like we did for the variable NAMET
STORE @(' ',LNAME) TO DEPTH2
* any spaces?
IF DEPTH2 > 0
* there is another space so we break it up into LNAME & MNAME
STORE $(LNAME,1,DEPTH2) TO MNAME
* here comes the last name
STORE $(LNAME,DEPTH2 + 1) TO LNAME
* next comes the attaching of first name and middle initial or name
STORE FNAME+MNAME TO FNAME
* all done (If some clown insists they have four names you can repeat
* this 'IF' for each name you want to cover!)
* get rid of MNAME before leaving
RELEASE MNAME
ENDIF two spaces, middle initial
ENDIF no space single word
* (for demo purposes only)
disp memo
* the jobs' not done until the cleanup is
RELEASE NAME, NAMET, DEPTH, DEPTH2
* and if you don't need length add it to the above line
RELEASE LENGTH
* you exit with FNAME & LNAME ,bye bye!
* (demo again)
?
?
? 'Name: last name first ',LNAME,',',FNAME