Rules for Usage
- Alphanumeric Functions
- An alphanumeric function can be specified wherever an identifier
is permitted in the general formats, and where the rules associated
with the general formats do not specifically prohibit reference to
functions. However it cannot be specified:
- As a receiving operand of any statement
- Where the rules associated with the general formats require the data item being referenced to have particular characteristics (such as class and category, usage, size, and permissible values) and the evaluation of the function according to its definition and the particular arguments specified does not have these characteristics.
A reference modification for an alphanumeric function is allowed. If reference modification is specified for a function, the evaluation of the reference modification takes place immediately after the evaluation of the function.
An alphanumeric function can be referenced as an argument for a function which allows an alphanumeric argument.
- Numeric Functions
- A numeric function can be used only where an arithmetic expression
can be specified.
A numeric function can be referenced as an argument for a function that allows a numeric argument.
A numeric function cannot be used where an integer operand is required, even if the particular reference will yield an integer value. The INTEGER or INTEGER-PART functions can be used to force the type of a numeric argument to be an integer.
- DBCS Functions
- A DBCS function can be specified wherever a DBCS identifier is
permitted in the general formats, and wherever the rules associated
with the general formats do not specifically prohibit reference to
functions. However, it cannot be specified:
- As a receiving operand of any statement.
- Where the rules associated with the general formats require the data item being referenced to have particular characteristics (such as class and category, usage, size, and permissible values), and the evaluation of the function according to its definition and the particular arguments specified does not have these characteristics.
A reference modification for a DBCS function is allowed. If reference modification is specified for a function, the evaluation of the reference modification takes place immediately after the evaluation of the function.
A DBCS function can be referenced as an argument for a function that allows a DBCS argument.
- National Functions
- A national function can be specified wherever a national identifier
is permitted in the general formats, and wherever the rules associated
with the general formats do not specifically prohibit reference to
functions. However, it cannot be specified:
- As a receiving operand of any statement.
- Where the rules associated with the general formats require the data item being referenced to have particular characteristics (such as class and category, usage, size, and permissible values), and the evaluation of the function according to its definition and the particular arguments specified does not have these characteristics.
A national function can be referenced as an argument for a function that allows a national argument.
- Date-Time Functions
- A date-time function can be specified wherever a date-time identifier
is permitted in the general formats, and wherever the rules associated
with the general formats do not specifically prohibit reference to
functions. However, it cannot be specified:
- As a receiving operand of any statement.
- Where the rules associated with the general formats require the data item being referenced to have particular characteristics (such as class and category, usage, size, and permissible values), and the evaluation of the function according to its definition and the particular arguments specified would not have these characteristics.
A date-time function is allowed as part of a relation condition. If a date-time function is specified in a relation condition, the evaluation of the relation condition takes place immediately after the evaluation of the function.
A date-time function can be referenced as an argument for a function that allows a date-time argument.
- Boolean Functions
- A boolean function can be specified wherever a boolean identifier
is permitted in the general formats, and wherever the rules associated
with the general formats do not specifically prohibit reference to
functions. However, it cannot be specified:
- As a receiving operand of any statement.
- Where the rules associated with the general formats require the data item being referenced to have particular characteristics (such as class and category, usage, size, and permissible values), and the evaluation of the function according to its definition and the particular arguments specified would not have these characteristics.
A boolean function is allowed as part of a relation condition. If a boolean function is specified in a relation condition, the evaluation of the relation condition takes place immediately after the evaluation of the function.
A boolean function can be referenced as an argument for a function that allows a boolean argument.
- Integer Functions
- An integer function can be used only where an arithmetic expression
can be specified.
An integer function can be referenced as an argument for a function that allows an integer argument.
- Special Usage Notes:
- Identifiers in the USING phrase of the CALL statement must not
be a function-identifier.
The COPY statement allows function-identifiers of all types in the REPLACING phrase.