F$LOCATE()

From VSI OpenVMS Wiki
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

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