Built-in Functions

REXX provides a rich set of built-in functions, including character manipulation, conversion, and information functions.

Other built-in and external functions are generally available; see External Functions Provided in REXX/CICS.

General notes on the built-in functions are as follows:
  • The parentheses in a function are always needed, even if no arguments are required. The first parenthesis must follow the name of the function with no space in between.
  • The built-in functions work internally with NUMERIC DIGITS 9 and NUMERIC FUZZ 0 and are unaffected by changes to the NUMERIC settings, except where stated. Any argument named as a number is rounded, if necessary, according to the current setting of NUMERIC DIGITS (just as though the number had been added to 0) and checked for validity before use. This occurs in the following functions: ABS, FORMAT, MAX, MIN, SIGN, and TRUNC, and for certain options of DATATYPE. This is not true for RANDOM.
  • Any argument named as a string can be a null string.
  • If an argument specifies a length, it must be a positive whole number or zero. If it specifies a start character or word in a string, it must be a positive whole number, unless otherwise stated.
  • Where the last argument is optional, you can always include a comma to indicate that you omitted it; for example, DATATYPE(1,), like DATATYPE(1), would return NUM. You can include any number of trailing commas; they are ignored. (Where there are actual parameters, the default values apply.)
  • If you specify a pad character, it must be exactly one character long. (A pad character extends a string, usually on the right. For an example, see the LEFT built-in function LEFT.)
  • If a function has an option you can select by specifying the first character of a string, that character can be in upper- or lowercase.
  • Some built-in functions support DBCS. For a complete list and descriptions of these functions, see Double-Byte Character Set (DBCS) Support.