|
VMS Help COBOL, PROCEDURE_DIVISION, miscellaneous_topics, functions *Conan The Librarian |
A function (synonymous with intrinsic function) is a temporary data
item that represents a value to be determined at the time the
function is referenced during the execution of a statement. The
value can be alphanumeric, numeric, or integer.
A function-identifier is a syntactically correct combination of
character strings and separators that uniquely references the data
item resulting from the evaluation of a function. Functions are
treated as elementary data items, but cannot be receiving operands. A
function-identifier that references an alphanumeric function can be
specified wherever an identifier is permitted and where a reference to
a function is not specifically prohibited by general-format rules. An
integer or numeric function can be used anywhere an arithmetic
expression can be used, subject to certain restrictions.
The general format of a function-identifier is as follows:
FUNCTION function-name [({argument}... )] [reference-modifier]
A function-name is one of the names listed below. Most function-names
are key words but not reserved words (the exceptions are LENGTH,
RANDOM, and SUM, which are reserved words, as is FUNCTION), and can
be used in a program outside the context of a function.
An argument is an identifier (including a function-identifier), a
literal an arithmetic expression, or a table that complies with the
specific rules governing the number, class, and category of arguments
for the function. The arguments in an argument list may be separated
by a comma; they are evaluated individually, from left to right.
A reference-modifier can be specified only for alphanumeric functions.
It specifies the beginning character position and optionally the
length of the resulting data item.
The functions are listed below. For a complete description of the
functions, including their formats, see the chapter on Intrinsic
Functions in the COBOL Reference Manual.
ACOS LENGTH ORD-MIN*
ANNUITY LOG PRESENT-VALUE*
ARGCOUNT LOG10 RANDOM
ASIN LOWER-CASE RANGE*
ATAN MAX* REM
CHAR MEAN* REVERSE
COS MEDIAN* SIN
CURRENT-DATE MIDRANGE* SQRT
DATE-OF-INTEGER MIN* STANDARD-DEVIATION*
DAY-OF-INTEGER MOD SUM*
FACTORIAL NUMVAL TAN
INTEGER NUMVAL-C UPPER-CASE
INTEGER-OF-DATE ORD VARIANCE*
INTEGER-OF-DAY ORD-MAX* WHEN-COMPILED
INTEGER-PART
*Functions which permit a variable number of arguments which may
include occurring items subscripted by "ALL" for one or more of
its dimensions.
In addition, five new Y2K functions are documented in the release notes:
YEAR-TO-YYYY
DATE-TO-YYYYMMDD
DAY-TO-YYYYDDD
TEST-DATE-YYYYMMDD
TEST-DAY-YYYYMMDD
|
|