VMS Help  —  MACRO  /ALPHA  Lexical Operators, %LOCATE
    Lexical operator for locating a string of text within another
    string of text.

    Format

      %LOCATE  (string1,string2)

1  –  Arguments

 string1

    The first argument, of type string, is the string for which
    %LOCATE searches.

 string2

    The second argument, of type string, is the string in which the
    search is performed.

2  –  Description

    %LOCATE is modeled after VAX MACRO's %LOCATE macro string
    operator and the OpenVMS DCL lexical function F$LOCATE. %LOCATE
    is used to locate one string within another. The value returned
    is the decimal offset to the first occurrence of the first string
    within the second string. The offset to the first character is 0.
    If the first string cannot be found within the second string, the
    length of the second string is returned.

3  –  Example

             .PRINT "%LOCATE (DEF,ABCDEFGHIJKLMNOP)"

      After lexical processing, the statement appears as:

             .PRINT "3"
Close Help