PARSEFNAME
8.2
The PARSEFNAME instruction retrieves a file name as described by the operating system in use from within a string variable. The instruction uses the following format:
|
|
|
|
|
Where:
label
Optional. A Program Execution Label.
source
Required. A previously defined Character String Variable from which the file name is retrieved.
sep
Required. A comma or one of the following prepositions: BY, TO, OF, FROM, USING, WITH, IN, or INTO.
dest
Required. A previously defined Character String Variable that receives the file name.
Flags Affected: EOS, LESS, OVER, ZERO
Note the following:
Leading blanks (or spaces) in the {source} string are bypassed.
String evaluation for transfer begins at the current Form Pointed character and terminates at the first invalid character or the end of the {source} Logical String whichever occurs first.
Upon completion of the transfer, the {source} Form Pointer is set to the last character transferred. If the end of the {source} string is encountered, its Form Pointer is set to zero.
Transfer into the {dest} operand begins with the first physical character. If no data is transferred, {dest} is nulled.
Once the transfer is complete, the {dest} Form Pointer is set to one (1) and the Length Pointer is set to the last character transferred.
This instruction operates in two modes:
If a filename begins with double quote (") character, the filename is scanned from the beginning double quote character to a terminating double quote character. If the terminating double quote character is followed by another double quote character, the scan continues. If there are any invalid filename characters placed into the output string between the beginning and ending double quotes, the LESS flag is set. The following characters are considered invalid filename characters:
PLBWIN < > * | ?
PLBCON < > * | ? + = [ ] ; , and white space
PLB < > * | ? + = [ ] ; , \ # ^ & ( ) ` and white space
The second mode of operation for this instruction is to terminate the data transfer when an invalid filename character is detected in the input string. In this case, the LESS flag would not be set since no invalid characters are transferred to the destination variable. The invalid characters used for this mode are as follows:
PLBWIN < > * | ? " ; , and white space
PLBCON < > * | ? " ; , + = [ ] and white space
PLB < > * | ? " ; , + = [ ] \ # ^ & ( ) ` and white space
The EOS Condition Flag is set if the {source} string is null or blank filled.
The EQUAL Condition Flag is set if characters are transferred.
The LESS Condition Flag is set if the {source} contains invalid characters. If characters less than a space or normally not allowed in filenames were found between the double quotes, the flag is set. The flag may be set if a string started with a double quote (") character but was not terminated by one.
If the {dest} string is too small to contain all bytes transferred, the OVER Condition Flag is set.
See Also: Example Code, Character String Instructions
![]() |