Built-In Functions
SET VAR1 = VAR1 !! VAR2 !! 'XX'
(!! is the concatenation character)
SET VAR2 = SUBSTR(&OYMD1,5,2) + 1
SET VAR3 = RIGHT(VAR1,2,'0')
SET VAR4 = LEFT(VAR4,3)
SET VAR5 = OVERLAY('X',VAR4,5)
Syntax of SUBSTR built-in function
SUBSTR(string,n,length,pad)
SET VAR1 = SUBSTR('abc',2) -> VAR1 = 'bc'
SET VAR1 = SUBSTR('abc',2,4) -> VAR1 = 'bc '
SET VAR1 = SUBSTR('abc',2,6,'.') -> VAR1 = 'bc....'
Syntax of RIGHT built-in function
RIGHT(string,length,pad)
The RIGHT built-in function returns a string of length length, containing the rightmost length characters of string. The string returned is padded with pad characters, or truncated, on the left, as necessary. The default padding character is a blank. length must be a positive whole number or zero.
SET VAR1 = RIGHT('abc d',8) -> VAR1 = ' abc d'
SET VAR1 = RIGHT('abc def',5) -> VAR1 = 'c def'
SET VAR1 = RIGHT('12',5,'0') -> VAR1 = '00012'
Syntax of LEFT built-in function
LEFT(string,length,pad)
The LEFT built-in function 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 necessary. The default padding 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)
SET VAR1 = LEFT('abc d',8) -> VAR1 = 'abc d '
SET VAR1 = LEFT('abc d',8,'.') -> VAR1 = 'abc d...'
SET VAR1 = LEFT('abc def',7) -> VAR1 = 'abc de'
Syntax of OVERLAY built-in function
OVERLAY(new,target,n,length,pad)
The OVERLAY built-in function returns the string target, which, starting at the nth character, is overlaid with the string new, padded or truncated to length length. (The overlay might extend beyond the end of the original target string.) If you specify length, it must be a positive whole number or zero. The default value for length is the length of new. If n is greater than the length of the target string, padding is added to the left of the new string. The default padding character is a blank, and the default value for n is 1. If you specify n, it must be a positive whole number.
SET VAR1 = OVERLAY(' ',VAR1,3) -> VAR1 = 'AB DEFGH'
SET VAR1 = OVERLAY('.',VAR1,3,2) -> VAR1 = 'AB. EFGH'
SET VAR1 = OVERLAY('qq',VAR1) -> VAR1 = 'qqCDEFGH'
SET VAR1 = OVERLAY('qq',VAR1,4) -> VAR1 = 'ABCqqFGH'
SET VAR1 = OVERLAY('123',VAR1,5,6,'+') -> VAR1 = 'ABCD123+++'
- CC = 0
- Instruction correctly processed
- CC = 8
- Invalid instruction. See the error message.