Difference between revisions of "F$LOCATE()"

From VSI OpenVMS Wiki
Jump to: navigation, search
(Created page with "'''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...")
 
 
Line 25: Line 25:
 
* [[F$ELEMENT()]]
 
* [[F$ELEMENT()]]
 
* [[F$EDIT()]]
 
* [[F$EDIT()]]
 +
 +
[[Category: Lexical Functions]]

Latest revision as of 05:48, 15 January 2019

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