SCNVARRGT SCAN VARIABLE FROM RIGHT TAACLPS
The Scan Variable from Right command is intended for scanning a
variable from the right for either the first non-blank or a specified
character string. A return value will contain the position where the
first non-blank or string was found. If not found, the return value
SCNVARRGT2 is a similar tool, but allows a 500 byte input value.
A typical command would be:
SCNVARRGT VAR(&NAME) RTNPOS(&RX) STRPOS(10)
The command would scan the variable &NAME for the first non-blank
from the right. The &RX value must be declared as *DEC LEN(3 0).
The STRPOS value is optional. It defaults to 500 which is the
maximum size of a variable which can be scanned. To improve the
performance of SCNVARRGT, STRPOS should be set to the length of the
variable to be scanned.
To scan from the right for a string you would specify:
SCNVARRGT VAR(&NAME) RTNPOS(&RX) STRPOS(10) STRING(DEF)
If the value of &NAME was 'ABCDEFGHIJ', the &RX value would be 4.
Trailing blanks in the string are automatically trimmed off to
determine the length of the compare.
The VAR value can be all blanks in which case the RTNPOS value will
be zero. The STRING value cannot be all blank.
Command parameters *CMD
VAR The character variable to be scanned. It can be all
blank. A maximum of 500 bytes is supported, but the
variable can be shorter in length.
RTNPOS The return value for where the value was found. It
must be declared as *DEC LEN(3 0). If not found, a
zero is returned (not an escape message). If a
string is specified, the leftmost position that
matches is returned (see previous example).
STRPOS The rightmost start position to begin the scan. The
default is 500, but should only be used if you have
a 500 byte variable to scan. To improve performance
of the scan, specify the length of the VAR value
that is being scanned. It must be a number between
1 and 500.
STRING The string to search for. The default is *NONBLANK
which means the rightmost non-blank character. A
string of up to 10 characters can be specified. If
a string is specified, trailing blanks are trimmed
off to determine the length of the compare. An all
blank string is invalid and an escape message will
Because of the return variable, the command can only be used in a CL
The following TAA Tools must be on your system:
SNDESCMSG Send escape message
None, the tool is ready to use.
Objects used by the tool
Object Type Attribute Src member Src file
------ ---- --------- ---------- ----------
SCNVARRGT *CMD TAACLPS QATTCMD
TAACLPSC *PGM CLP TAACLPSC QATTCL
Added to TAA Productivity tools April 1, 1995