.; PARSE.IND - IND Control file for parsing a filespec. .; .; Normally called from another control file. .; In calling file, use the following statements: .; ... .; .enable global .; .sets $DEFDV "[xxn:]" .;The default device may be null. .; .;Include a ":" if not null device. .; .sets $DEFXT "[.ext]" .;The default extension may be null or *. .; .;Include a "." if not null extension. .; ... .; @PARSE 'INPUT' [P2] .; ... .; Symbols returned are $FILSP, $FILNM and $DEV, where .; $FILSP contains the entire filespec (DEV:FILNAM.EXT), .; $FILNM contains the name and extension (FILNAM.EXT), and .; $DEV separately contains the device (DEV:), terminated by a :. .; If $DEFDV is null, then $DEV will return null if a device is not .; specified in the input. .; .; In PARSE, P1 is 'INPUT' from the calling routine. .; P2 is a flag. If it is non-null, no physical device checking is .; done (this is useful for filespecs to be used in TRANSF commands). .; .; Written by: .; R. W. Barnard .; BIO/Comp Applications .; Albuquerque, NM 87185 .; .; Version 4.02, 1-Feb-88. .; .sets FNAME P1 .;Save the input as the file name. .test P1 ":" .;See if a device was given. .if ne 0 .goto 10 .; .if $DEFDV eq "" .sets P2 "1" .;No device check for null default. .sets $DEV $DEFDV .;No device was supplied. .goto 20 .; .; A device was given - parse the filespec. .10: .parse P1 ":" $DEV FNAME .sets $DEV $DEV+":" .20: .if P2 ne "" .goto 30 .;Do a physical device check? .testdevice '$DEV' .parse "," $DEV REST .sets $DEV $DEV+":" .;This is the physical device name. .; .; Now work on the file name. .30: .if FNAME ne "" .goto 40 .;Was a file name given? .sets EXT "" .;No file name was given, .goto 50 .;so set everything to null. .; .40: .sets EXT $DEFXT .test FNAME "." .;See if . was entered. .if eq 0 .goto 50 .;No extension was given-use default. .parse FNAME "." FNAME EXT .sets EXT "."+EXT .;This is the extension supplied. .; .50: .sets $FILNM "'FNAME''EXT'" .;Build the file name. .sets $FILSP "'$DEV''$FILNM'" .;Build the complete file spec. .; .exit