Tuesday, September 26, 2006

VERIFY in PL/1

Searches for first non-occurrence of any one of the elements of a string within another string.

VERIFYR:
Does same as VERIFY command, but the search starts from the right.

Example 1:
DCL MAINSTR CHAR(6) INIT ('A B ');
DCL SUBSTRG CHAR(1) INIT (' ');
DCL (POSN,RTN) FIXED BINARY(31,0);
RTN = VERIFY(MAINSTR, SUBSTRG, POSN);

When POSN=1, RTN = 1;
When POSN=2, RTN = 4;

Example 2:
DCL MAINSTR CHAR(6) INIT ('ANUK ');
DCL SUBSTRG CHAR(2) INIT ('NA');
RTN = VERIFY(MAINSTR, SUBSTRG);

Default search starts from 1st position.
RTN=3