LASTPOS (Last Position)
LASTPOS(needle,haystack
,start
)
returns the position of the last occurrence of one string, needle, in another, haystack. (See also the POS
function.) Returns 0 if needle is the null string or is not found. By default the search starts at the last
character of haystack and scans backward. You can override this by specifying start, the point at which the
backward scan starts. start must be a positive whole number and defaults to LENGTH(haystack) if larger
than that value or omitted.
Here are some examples:
LASTPOS(' ','abc def ghi') -> 8
LASTPOS(' ','abcdefghi') -> 0
LASTPOS('xy','efgxyz') -> 4
LASTPOS(' ','abc def ghi',7) -> 4
LEFT
LEFT(string,length
,pad
)
returns a string of length length, containing the leftmost length characters of string. The string returned is
padded with pad characters (or truncated) on the right as needed. The default pad character is a blank.
length must be a positive whole number or zero. The LEFT function is exactly equivalent to:
SUBSTR(string,1,length
,pad
)
Here are some examples:
LEFT('abc d',8) -> 'abc d '
LEFT('abc d',8,'.') -> 'abc d...'
LEFT('abc def',7) -> 'abc de'
LENGTH
LENGTH(string)
returns the length of string.
Here are some examples:
LENGTH('abcdefgh') -> 8
LENGTH('abc defg') -> 8
LENGTH('') -> 0
LINESIZE
LINESIZE()
returns the current terminal line width (the point at which the language processor breaks lines displayed
using the SAY instruction). Returns a default value of 80 if:
v No terminal is attached.
v Output is being redirected.
Note: To determine if a terminal is attached, specify the REXX/CICS command SCRNINFO. The values
for screen height and screen width are 0 if there is no terminal attached.
MAX (Maximum)
Functions
188
CICS TS for VSE/ESA: REXX Guide