F$LOCATE()

From VSI OpenVMS Wiki
Revision as of 05:48, 15 January 2019 by Darya.zelenina (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

F$LOCATE() is a lexical function that locates a specified portion of a character string and returns as an integer the offset of the first character.

Format

F$LOCATE(substring,string)

Substring is the portion of the string that needs to be located. String is the string where the substring should be located.

Examples

Find out the length of the filename by locating the dot character:

$ FILE_SPEC = "MYFILE.DAT;1"
$ NAME_LENGTH = F$LOCATE(".",FILE_SPEC)
 

Find out if a user is disusered by analyzing the line that contains the user's account flags:

$ line = "Flags:  PwdMix"
$ if f$locate("DisUser",line) .nes. f$length(line) then write sys$output "Disusered"
 

See also