Arguments

The values returned by some functions are determined by the arguments specified in the function-identifier when the functions are evaluated. Some functions require no arguments; others require a fixed number of arguments; and still others allow a variable number of arguments.

An argument must be one of the following:
  • An identifier
  • An arithmetic expression
  • A function-identifier
  • A literal other than a figurative constant
  • A special-register
  • A mnemonic-name
  • A keyword.

The argument to a function can be any function or expression containing a function, including another evaluation of the same function, whose result meets the category requirement for the argument.

See Function Definitions for function specific argument specifications.

The types of arguments are:

Alphabetic
An elementary data item of the class alphabetic or a nonnumeric literal containing only alphabetic characters. The content of the argument is used to determine the value of the function. The length of the argument can be used to determine the value of the function.
Alphanumeric
A data item of the class alphabetic or alphanumeric or a nonnumeric literal. The content of the argument will be used to determine the value of the function. The length of the argument can be used to determine the value of the function.
IBM Extension
IBM Extension
Boolean
A data item of class boolean, or a boolean literal.
DBCS
A data item of the class DBCS or a DBCS literal. The content of the argument is used to determine the value of the function. The length of the argument can be used to determine the value of the function.
Start of changeNationalEnd of change
Start of changeA data item of the class NATIONAL or a national literal. The content of the argument is used to determine the value of the function. The length of the argument can be used to determine the value of the function.End of change
Date-Time
An data item of the class date-time. The content of the argument is used to determine the value of the function. The length of the argument can be used to determine the value of the function.
End of IBM Extension
End of IBM Extension
Index
An index data item. The size associated with the argument may be used in determining the value of the argument.
Integer
An arithmetic expression that always results in an integer value. The value of this expression, including its sign, is used to determine the value of the function.
Numeric
An arithmetic expression, whose value, including its sign, is used to determine the value of the function.
IBM Extension
IBM Extension
Keyword
A keyword should be specified in accordance with the function definition.
Mnemonic-Name
A mnemonic-name defined in the SPECIAL-NAMES paragraph shall be specified. The feature associated with the mnemonic-name may be used in determining the value of the function.
Pointer
A pointer identifier. The size associated with the argument may be used in determining the value of the function.
Type Declaration
A type-name shall be specified. The size associated with the type declaration may be used in determining the value of the function.
Special-Register
A special-register should be specified in accordance with the function definition. The information associated with the special-register may be used in determining the value of the function.
End of IBM Extension
End of IBM Extension

Some functions place constraints on their arguments, such as the range of values acceptable. If the values assigned as arguments for a function do not comply with specified constraints, the returned value is undefined.

If a nested function is used as an argument, the evaluation of its arguments will not be affected by the arguments in the outer function.

Only those arguments at the same function level interact with each other. This interaction occurs in two areas:
  • The computation of an arithmetic expression that appears as a function argument will be affected by other arguments for that function.
  • The evaluation of the function takes into consideration the attributes of all of its arguments.

IBM Extension
IBM Extension

Floating-point literals are allowed wherever a numeric argument is allowed, and in arithmetic expressions that are used in functions that allow a numeric argument. They are not allowed where an integer argument is required.

External floating-point items are allowed wherever a numeric argument is allowed, and in arithmetic expressions that are used in functions that allow a numeric argument.

External floating-point items are not allowed where an integer argument is required, or where an argument of alphanumeric class is allowed in a function identification, such as in the LOWER-CASE, REVERSE, UPPER-CASE, NUMVAL, and NUMVAL-C functions.

End of IBM Extension
End of IBM Extension