ANS85 

Definitions of Functions

The table below summarizes the intrinsic functions that are available.

The "arguments" column defines argument type and the "type" column defines the type of the function, as follows:

Alph means alphabetic
Anum means alphanumeric
Int means integer
Nat means national
Num means numeric
UTF8 means UTF-8 (support is for native COBOL code only)
Table 1. Summary of Functions
Function-Name Arguments Type Value Returned
The ABS Function Int1, or Num1 Depends upon arguments The absolute value of argument
The ACOS Function Num1 Num Arccosine of Num1
The ANNUITY Function Num1, or Int2 Num Ratio of annuity paid for Int2 periods at interest of Num1 to initial investment of one
The ASIN Function Num1 Num Arcsine of Num1
The ATAN Function Num1 Num Arctangent of Num1
The BIT-OF Function Alph1, or Anum1, or Num1, or Int1, or ENT Nat1 , or ENT UTF81 Anum Binary representation of argument
The BIT-TO-CHAR Function Anum1 Anum Character string of bytes corresponding to binary input
The BYTE-LENGTH Function Alph1, or Anum1, or Num1, or Int1, or ENT Nat1 , or ENT UTF81 Int Length, in bytes, of argument
The CHAR Function Int1 Anum Character in position Int1 of the alphanumeric program collating sequence
The CHAR-NATIONAL Function Int1 Nat Character in position Int1 of the national program collating sequence
The COS Function Num1 Num Cosine of Num1
The CURRENT-DATE Function None Anum Current date and time and difference from Greenwich Mean Time
The DATE-OF-INTEGER Function Int1 Int Standard date equivalent (YYYYMMDD) of integer date
The DATE-TO-YYYYMMDD Function Int1, or Int2 Int Argument-1 converted from YYMMDD to YYYYMMDD based on the value of argument-2
The DAY-OF-INTEGER Function Int1 Int Julian date equivalent (YYYYDDD) of integer date
The DAY-TO-YYYYDDD Function Int1, or Int2 Int Argument-1 converted from YYDDD to YYYYDDD based on the value of argument-2
The DISPLAY-OF Function Num1, or ENTMF Anum1 , or ENT Nat1 , or ENT UTF81 Anum Usage display representation of argument Nat1
The E Function None Num The value of e, the natural base
The EXP Function Num1 Num e raised to the power Num1
The EXP10 Function Num1 Num 10 raised to the power Num1
The FACTORIAL Function Int1 Int Factorial of Int1
The FRACTION-PART Function Num1 Num Fraction part of Num1
The HEX-OF Function Alph1, or Anum1, or Num1, or Int1, or ENT Nat1 , or ENT UTF81 Anum Hexadecimal representation of argument
The HEX-TO-CHAR Function Anum1 Anum Character string of bytes corresponding to hexadecimal input
The INTEGER Function Num1 Int The greatest integer not greater than Num1
The INTEGER-OF-DATE Function Int1 Int The integer date equivalent of standard date (YYYYMMDD)
The INTEGER-OF-DAY Function Int1 Int The integer date equivalent of Julian date (YYYYDDD)
The INTEGER-PART Function Num1 Int Integer part of Num1
The LENGTH Function Alph1, or Anum1, or MF Num1 , or ENT Nat1 , or ENT UTF81 Int Length of argument in number of character positions
The LENGTH-AN Function Alph1, or Anum1, or Int1, or Nat1, or Num1 Int Length of argument in number of alphanumeric character positions
The LOG Function Num1 Num Natural logarithm of Num1
The LOG10 Function Num1 Num Logarithm to base 10 of Num1
The LOWER-CASE Function Alph1, or Anum1, or ENT Nat1 , or ENT UTF81 Depends upon argument* All letters in the argument are set to lowercase
The MAX Function Alph1 ..., or Anum1 ..., or Int1 ..., or MF Nat1 ... , or MF Num1 ... Depends upon arguments* Value of maximum argument
The MEAN Function Num1 ... Num Arithmetic mean of arguments
The MEDIAN Function Num1 ... Num Median of arguments
The MIDRANGE Function Num1 ... Num Mean of minimum and maximum arguments
The MIN Function Alph1 ..., or Anum1 ..., or Int1 ..., or MF Nat1 ..., or MF Num1 ... Depends upon arguments* Value of minimum argument
The MOD Function Int1, or Int2 Int Int1 modulo Int2
The NATIONAL-OF Function Anum1, or MF Num1 , or ENT Nat1 , or ENT UTF81 Nat Usage national representation of argument Anum1
The NUMVAL Function Anum1, or MF Nat1 Num Numeric value of simple numeric string
The NUMVAL-C Function Anum1 and Anum2, or MF Nat1 and Nat2 Num Numeric value of numeric string with optional commas and currency string
The NUMVAL-F Function Anum1, or Nat1 Num A floating-point approximation of the numeric value represented by Anum1 or Nat1
The ORD Function Alph1, or Anum1, or MF Nat1 Int Ordinal position of the argument in collating sequence
The ORD-MAX Function Alph1 ..., or Anum1 ..., or MF Nat1 ... , or MF Num1 ... Int Ordinal position of maximum argument
The ORD-MIN Function Alph1 ..., or Anum1 ..., or MF Nat1 ... , or MF Num1 ... Int Ordinal position of minimum argument
The PI Function None Num Value of
The PRESENT-VALUE Function Num1 ..., or Num2 ... Num Present value of a series of future period-end amounts, Num2, at a discount rate of Num1
The RANDOM Function Int1 Num Random number
The RANGE Function Int1 ..., or Num1 ... Depends upon arguments* Value of maximum argument minus value of minimum arguments
The REM Function Num1, or Num2 Num Remainder of Num1/Num2
The REVERSE Function Alph1, or Anum1, or ENT Nat1 Depends upon argument* Reverse order of the characters of the argument
The SIGN Function Num1 Int The sign of Num1
The SIN Function Num1 Num Sine of Num1
The SQRT Function Num1 Num Square root of Num1
The STANDARD-DEVIATION Function Num1 ... Num Standard deviation of arguments
The SUM Function Int1 ..., or Num1 ... Depends upon arguments Sum of arguments
The TAN Function Num1 Num Tangent of Num1
The TEST-NUMVAL Function Anum1, or Nat1 Int Zero if argument conforms to NUMVAL function specification, or numeric value indicating the position of first character that doesn't conform.
The TEST-NUMVAL-C Function Anum1, or Nat1 Int Zero if argument conforms to NUMVAL-C function specification, or numeric value indicating the position of first character that doesn't conform.
The TEST-NUMVAL-F Function Anum1, or Nat1 Int Zero if argument conforms to NUMVAL-C function specification, or numeric value indicating the position of first character that doesn't conform.
The TRIM Function Alph1, or Anum1, or ENT Nat1 , or ENT UTF81 Depends upon argument* Argument with leading spaces, trailing spaces, or both, removed
The ULENGTH Function Alph1, or Anum1, or ENT  Nat1 , or ENT  UTF81 Int Number of characters in argument-1
The UPOS Function Alph1, or Anum1, or Int1, or ENT Nat1 , or ENT UTF81 Int Position of nth UTF-8 or UTF-16 char in argument-1
The UPPER-CASE Function Alph1, or Anum1, or ENT Nat1 , or ENT UTF81 Depends upon argument* All letters in the argument are set to uppercase
The USUBSTR Function Alph1, or Anum1, or Num1, or Num2, or ENT Nat1 , or ENT UTF81 Anum Substring of a character string argument that is encoded in UTF-8 or UTF-16
The USUPPLEMENTARY Function Alph1, or Anum1, or ENT Nat1 , or ENT UTF81 Int Integer value that is equal to the index of the first Unicode supplementary character in a character string argument that is encoded in UTF-8 or UTF-16
The UVALID Function Alph1, or Anum1, or ENT Nat1 , or ENT UTF81 Int Zero if character string consists of valid Unicode UTF-8 or UTF-16 data; non-zero if not.
The UWIDTH Function Alph1, or Anum1, or Int1, or ENT Nat1 , or ENT UTF81 Int integer value that is equal to the width in bytes of the nth UTF-8 or UTF-16 character in a character string
The VARIANCE Function Num1 ... Num Variance of argument
The WHEN-COMPILED Function None Anum Date and time program was compiled
The YEAR-TO-YYYY Function Int1, or Int2 Int Argument-1 converted from YY to YYYY based on the value of argument-2

* A function that has only alphabetic arguments is type alphanumeric.