Tuesday, 30 April 2013

To find Offset of a character in a string




  PARAMETERS name TYPE LENGTH 26 DEFAULT 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'.
PARAMETERS TYPE LENGTH 10.

DATA TYPE i.

FIND IN name MATCH OFFSET k.


WRITE / name/ k.



j  is the character we enter to search in the variable name, k holds the offset of  value in  j   with respect to   name.

Offset starts from 0 (zero) always.

offset or position of   A   is  0,  B  is 1 ....... Z is 25.

No comments:

Post a Comment