Function definitions

This section provides an overview of the argument type, function type, and value returned for each of the intrinsic functions.

For more information about the intrinsic functions, see Table 1.

Argument types and function types are abbreviated as follows:

Abbreviation Meaning
A Alphabetic
D DBCS
I Integer
Start of changeKEnd of change Start of changeKeywordEnd of change
N Numeric
O Other, as specified in the function definition (pointer, function-pointer, procedure-pointer, or object reference)
U National
X Alphanumeric
Start of changeUTEnd of change UTF-8

Each intrinsic function is described in detail in the topics that follow the table below.

Table 1. Table of functions
Function name Arguments Function type Value returned
Start of changeABSEnd of change Start of changeN1End of change Start of changeI or NEnd of change Start of changeAbsolute value of N1End of change
ACOS N1 N Arccosine of N1
ANNUITY N1, I2 N Ratio of annuity paid for I2 periods at interest of N1 to initial investment of one
ASIN N1 N Arcsine of N1
ATAN N1 N Arctangent of N1
Start of changeBIT-OFEnd of change Start of changeA1, D1, I1, N1, X1, U1, UT1, or O1End of change Start of changeXEnd of change Start of changeAlphanumeric character string consisting of characters "1" and "0" that correspond to the binary value of each byte in the argumentEnd of change
Start of changeBIT-TO-CHAREnd of change Start of changeX1End of change Start of changeXEnd of change Start of changeCharacter string consisting of bytes that correspond to the bit pattern indicated by the sequence of "0" and "1" characters in the argumentEnd of change
Start of changeBYTE-LENGTHEnd of change Start of changeA1, D1, N1, X1, U1, UT1, or O1End of change Start of changeIEnd of change Start of changeInteger that is equal to the length of the argument in bytesEnd of change
CHAR I1 X Character in position I1 of program collating sequence
Start of changeCOMBINED-DATETIMEEnd of change Start of changeI1, N2End of change Start of changeNEnd of change Start of changeNumeric representation of combined integer date and standard numeric timeEnd of change
COS N1 N Cosine of N1
CURRENT-DATE None X Current date and time and difference from Greenwich mean time
DATE-OF-INTEGER I1 I Standard date equivalent (YYYYMMDD) of integer date
DATE-TO-YYYYMMDD I1, I2 I Standard date equivalent (YYYYMMDD) of I1 (standard date with a windowed year, YYMMDD), according to the 100-year interval whose ending year is specified by the sum of I2 and the year at execution time
DAY-OF-INTEGER I1 I Julian date equivalent (YYYYDDD) of integer date
DAY-TO-YYYYDDD I1, I2 I Julian date equivalent (YYYYDDD) of I1 (Julian date with a windowed year, YYDDD), according to the 100-year interval whose ending year is specified by the sum of I2 and the year at execution time
DISPLAY-OF
Start of changeU1, UT1, I2
End of change
X Each character in U1Start of change or UT1End of change converted to a corresponding character representation using a code page identified by I2, if specified, or a default code page selected at compile time if I2 is unspecified
Start of changeEEnd of change Start of changeNoneEnd of change Start of changeNEnd of change Start of changeApproximation of e, the base of natural logarithmsEnd of change
Start of changeEXPEnd of change Start of changeN1End of change Start of changeNEnd of change Start of changeApproximation of the value of e raised to the power of N1End of change
Start of changeEXP10End of change Start of changeN1End of change Start of changeNEnd of change Start of changeApproximation of the value of 10 raised to the power of N1End of change
FACTORIAL I1 I Factorial of I1
Start of changeFORMATTED-CURRENT-DATEEnd of change Start of changeU1, X1, or UT1End of change Start of changeU, X, or UTEnd of change Start of changeFormatted date equivalent of current date and time in the format specified in argument-1End of change
Start of changeFORMATTED-DATEEnd of change Start of changeU1, X1, or UT1, I2End of change Start of changeU, X, or UTEnd of change Start of changeFormatted date equivalent of integer date contained in argument-2 in the format specified in argument-1End of change
Start of changeFORMATTED-DATETIMEEnd of change Start of changeU1, X1, or UT1, I2, N3, I4End of change Start of changeU, X, or UTEnd of change Start of changeFormatted date (from integer date in argument-2) and time (from standard numeric time in argument-3) in the format specified by argument-1. Offset from UTC, if the format requires it, is supplied by argument-4End of change
Start of changeFORMATTED-TIMEEnd of change Start of changeU1, X1, or UT1, N2, I3End of change Start of changeU, X, or UTEnd of change Start of changeFormatted time equivalent of standard numeric time contained in argument-2 in the format specified in argument-1. Offset from UTC, if the format requires it, is supplied by argument-3End of change
Start of changeHEX-OFEnd of change Start of changeA1, D1, I1, N1, X1, U1, UT1, or O1End of change Start of changeXEnd of change Start of changeAlphanumeric character string consisting of the bytes of the argument converted to a hexadecimal representationEnd of change
Start of changeHEX-TO-CHAREnd of change Start of changeX1End of change Start of changeXEnd of change Start of changeCharacter string consisting of bytes that correspond to the hexadecimal digit characters in the argumentEnd of change
INTEGER N1 I The greatest integer not greater than N1
INTEGER-OF-DATE I1 I Integer date equivalent of standard date (YYYYMMDD)
INTEGER-OF-DAY I1 I Integer date equivalent of Julian date (YYYYDDD)
Start of changeINTEGER-OF-FORMATTED-DATEEnd of change Start of changeU1, UT1, or X1, U2, UT2, or X2End of change Start of changeIEnd of change Start of changeInteger date equivalent of date contained in argument-2 whose format is described by argument-1End of change
INTEGER-PART N1 I Integer part of N1
LENGTH A1, N1, O1, X1, Start of changeU1, or UT1End of change I Length of argument in national character positions or in alphanumeric character positions or bytes, depending on the argument type
LOG N1 N Natural logarithm of N1
LOG10 N1 N Logarithm to base 10 of N1
LOWER-CASE A1 or X1 X All letters in the argument set to lowercase
U1 U All letters in the argument set to lowercase
Start of changeUT1End of change Start of changeUTEnd of change Start of changeAll letters in the argument set to lowercaseEnd of change
MAX A1... X Value of maximum argument; note that the type of function depends on the arguments
I1... I Value of maximum argument; note that the type of function depends on the arguments
N1... N Value of maximum argument; note that the type of function depends on the arguments
X1... X Value of maximum argument; note that the type of function depends on the arguments
U1... U Value of maximum argument; note that the type of function depends on the arguments
MEAN N1... N Arithmetic mean of arguments
MEDIAN N1... N Median of arguments
MIDRANGE N1... N Mean of minimum and maximum arguments
MIN A1... X Value of minimum argument; note that the type of function depends on the arguments
I1... I Value of minimum argument; note that the type of function depends on the arguments
N1... N Value of minimum argument; note that the type of function depends on the arguments
X1... X Value of minimum argument; note that the type of function depends on the arguments
U1... U Value of minimum argument; note that the type of function depends on the arguments
MOD I1, I2 I I1 modulo I2
NATIONAL-OF A1, X1, Start of changeD1, or UT1End of change U The characters in the argument converted to national characters, using the code page identified by I2, if specified, or a default code page selected at compile time if I2 is unspecified
A1, X1, Start of changeD1, or UT1End of change; I2 U The characters in the argument converted to national characters, using the code page identified by I2, if specified, or a default code page selected at compile time if I2 is unspecified
NUMVAL Start of changeX1 or U1End of change N Numeric value of simple numeric string
NUMVAL-C
Start of changeX1 or U1;
X1, X2;
U1, U2End of change
N Numeric value of numeric string with optional commas and currency sign
Start of changeNUMVAL-FEnd of change Start of change
X1 or U1
End of change
Start of changeNEnd of change Start of changeNumeric value or approximation of the numeric value represented by the alphanumeric character string or national character string specified as the argumentEnd of change
ORD A1 or X1 I Ordinal position of the argument in collating sequence
ORD-MAX A1..., N1..., X1..., or U1... I Ordinal position of maximum argument
ORD-MIN A1..., N1..., X1..., or U1... I Ordinal position of minimum argument
Start of changePIEnd of change Start of changeNoneEnd of change Start of changeNEnd of change Start of changeValue that is an approximation of pi, the ratio of the circumference of a circle to its diameter.End of change
PRESENT-VALUE N1, N2... N Present value of a series of future period-end amounts, N2, at a discount rate of N1
RANDOM I1, none N Random number
RANGE I1... I Value of maximum argument minus value of minimum argument; note that the type of function depends on the arguments.
N1... N Value of maximum argument minus value of minimum argument; note that the type of function depends on the arguments.
REM N1, N2 N Remainder of N1/N2
REVERSE A1 or X1 X Reverse order of the characters of the argument
U1 U Reverse order of the characters of the argument
Start of changeSECONDS-FROM-FORMATTED-TIMEEnd of change Start of changeU1, UT1, or X1, U2, UT2, or X2End of change Start of changeNEnd of change Start of changeStandard numeric time equivalent of the data contained in argument-2 as described by the format specified in argument-1End of change
Start of changeSECONDS-PAST-MIDNIGHTEnd of change   Start of changeNEnd of change Start of changeSeconds past midnight as provided by the systemEnd of change
Start of changeSIGNEnd of change Start of changeN1End of change Start of changeIEnd of change Start of change+1, 0, or -1 depending on the sign of the argumentEnd of change
SIN N1 N Sine of N1
SQRT N1 N Square root of N1
STANDARD-DEVIATION N1... N Standard deviation of arguments
SUM I1... I Sum of arguments; note that the type of function depends on the arguments.
N1... N Sum of arguments; note that the type of function depends on the arguments.
TAN N1 N Tangent of N1
Start of changeTEST-DATE-YYYYMMDDEnd of change Start of changeI1End of change Start of changeIEnd of change Start of change0 if argument-1 is a valid standard date; otherwise identifies the sub-field in errorEnd of change
Start of changeTEST-DAY-YYYYDDDEnd of change Start of changeI1End of change Start of changeIEnd of change Start of change0 if argument-1 is a valid Julian date; otherwise identifies the sub-field in errorEnd of change
Start of changeTEST-FORMATTED-DATETIMEEnd of change Start of changeU1, UT1, or X1, U2, UT2, or X2End of change Start of changeIEnd of change Start of change0 if argument-2 conforms in form to the format specified in argument-1 and represents a valid date, time or combined representation according to that description; otherwise, identifies the character in errorEnd of change
Start of changeTEST-NUMVALEnd of change Start of changeX1 or U1End of change Start of changeIEnd of change Start of change
  • If the content of argument-1 conforms to the argument rules for the NUMVAL function, the returned value is 0.
  • If one or more characters are in error, the returned value is the position of the first character in error.
  • Otherwise, the returned value is (FUNCTION LENGTH (argument-1) + 1).
End of change
Start of changeTEST-NUMVAL-CEnd of change Start of change
X1 or U1;
X1, X2;
U1, U2
End of change
Start of changeIEnd of change Start of change
  • If the content of argument-1 conforms to the argument rules for the NUMVAL-C function, the returned value is 0.
  • If one or more characters are in error, the returned value is the position of the first character in error.
  • Otherwise, the returned value is (FUNCTION LENGTH (argument-1) + 1).
End of change
Start of changeTEST-NUMVAL-FEnd of change Start of change
X1 or U1
End of change
Start of changeIEnd of change Start of changeStart of change
  • If the content of argument-1 conforms to the argument rules for the NUMVAL-F function, the returned value is 0.
  • If one or more characters are in error, the returned value is the position of the first character in error.
  • Otherwise, the returned value is (FUNCTION LENGTH (argument-1) + 1).
End of changeEnd of change
Start of changeTRIMEnd of change Start of changeA1, X1, U1, or UT1; K1End of change Start of changeX, U, or UTEnd of change Start of changeCharacter string that contains the characters in A1, X1, or U1 with leading spaces or trailing spaces deleted (if K1 is specified)End of change
Start of changeA1, X1, U1, or UT1End of change Start of changeX, U, or UTEnd of change Start of changeCharacter string that contains the characters in A1, X1, or U1 with both leading spaces and trailing spaces deleted (if K1 is unspecified)End of change
ULENGTH Start of changeA1, X1, U1, or UT1End of change I Length of Start of changeA1, X1, U1, or UT1End of change in UTF-8Start of change or UTF-16End of change characters
UPOS Start of changeA1, X1, U1, or UT1End of change, I2 I Index of the I2th UTF-8Start of change or UTF-16End of change character of Start of changeA1, X1, U1, or UT1End of change
UPPER-CASE A1 or X1 X All letters in the argument set to uppercase
U1 U All letters in the argument set to uppercase
Start of changeUT1End of change Start of changeUTEnd of change Start of changeAll letters in the argument set to uppercaseEnd of change
USUBSTR Start of changeA1, X1, U1, or UT1End of change, I2, I3 XStart of change, U, or UTEnd of change Alphanumeric character string that contains the I3 UTF-8Start of change or UTF-16End of change characters of Start of changeA1, X1, U1, or UT1End of change, starting at the I2th character position
USUPPLEMENTARY A1, X1, U1, or UT1 I Index of the first Unicode supplementary character of A1, X1, U1, or UT1
Start of changeUUID4End of change Start of changeNoneEnd of change Start of changeXEnd of change Start of change36-character alphanumeric string that is a version 4 universally unique identifier (UUID)End of change
UVALID A1, X1, U1, or UT1 I 0 if A1, X1, U1, or UT1 contains valid Unicode UTF-8 or UTF-16 data, or the index of the first invalid element of A1, X1, U1, or UT1
UWIDTH Start of changeA1, X1, U1, or UT1End of change, I2 I Width in bytes of the I2th UTF-8Start of change or UTF-16End of change character of Start of changeA1, X1, U1, or UT1End of change
VARIANCE N1... N Variance of arguments
WHEN-COMPILED None X Date and time when program was compiled
YEAR-TO-YYYY I1, I2 I Expanded year equivalent (YYYY) of I1 (windowed year, YY), according to the 100-year interval whose ending year is specified by the sum of I2 and the year at execution time