COBOL Manual for TNS and TNS/R Programs
Intrinsic Functions
HP COBOL Manual for TNS and TNS/R Programs—522555-006
14-3
Intrinsic Function Types
Intrinsic Function Types
The type of an intrinsic function is the type of the value it returns. An intrinsic function
can be:
•
Alphanumeric Intrinsic Functions
•
Numeric Intrinsic Functions
•
Integer Intrinsic Functions
•
Variable-Type Intrinsic Functions
You can use an integer function wherever you can use a numeric operand, but you
cannot use a numeric function where an integer operand is required, even if a
particular reference to the numeric function returns an integer value.
You can nest intrinsic functions; that is, you can use one intrinsic function as the
argument of another. The function that is used as the argument must be of the type
required for that argument.
For example,
FUNCTION MAX ( FUNCTION INTEGER(X) FUNCTION INTEGER-PART(X) )
is allowed because the functions INTEGER and INTEGER-PART are integer functions
and the function MAX accepts integer arguments.
FUNCTION UPPER-CASE ( FUNCTION FACTORIAL(5) )
is not allowed because the function FACTORIAL is an integer function and the function
UPPER-CASE requires an alphanumeric argument.
Alphanumeric Intrinsic Functions
An alphanumeric intrinsic function returns an alphanumeric value (a string of one or
more alphanumeric characters).
Table 14-1. Alphanumeric Intrinsic Functions
Function Name Value Returned
CHAR Function
Character in specified position of program
collating sequence
CURRENT-DATE Function
Current date and time and difference from
Greenwich mean time
LOWER-CASE Function
Its argument with all letters set to lowercase
REVERSE Function
Its argument with characters in reverse order
UPPER-CASE Function
Its argument with all letters set to uppercase
WHEN-COMPILED Function
Date and time when program was compiled