Reverse Locate
You can locate from the back of the string using option "DR" in the locate command.
Example:
PROGRAM TEST.LOCATE$INCLUDE T24.BP I_COMMON
$INCLUDE T24.BP I_EQUATE
Y.STRING = 30:VM:30:VM:30:VM:30:VM:30:VM:30
LOCATE 30 IN Y.STRING<1,1> BY "DR" SETTING POS THEN
CRT POS
END
$INCLUDE T24.BP I_EQUATE
Y.STRING = 30:VM:30:VM:30:VM:30:VM:30:VM:30
LOCATE 30 IN Y.STRING<1,1> BY "DR" SETTING POS THEN
CRT POS
END
STOP
The result will be 6. Usually the answer will be 1 using LOCATE command
Comments
Post a Comment