The POSITION function returns the first position (in characters) of a substring in a source string.
Is the substring whose position you want to locate. The string can be as short as a single character, including a single blank.
Is the string in which to find the pattern.
The data type of the returned value is Integer.
In the following request against the EMPLOYEE data source, POSITION determines the position of the first capital letter I in LAST_NAME and stores the result in I_IN_NAME:
TABLE FILE EMPLOYEE PRINT LAST_NAME AND COMPUTE I_IN_NAME/I2 = POSITION('I', LAST_NAME); ON TABLE SET PAGE NOPAGE END
The output is:
LAST_NAME I_IN_NAME --------- --------- STEVENS 0 SMITH 3 JONES 0 SMITH 3 BANNING 5 IRVING 1 ROMANS 0 MCCOY 0 BLACKWOOD 0 MCKNIGHT 5 GREENSPAN 0 CROSS 0