Using Compaq COBOL in the Alpha Common Language Environment
13.4 Calling Routines
As stated earlier, this example does not pass a value for the optional handle-
address argument.
The FORMAT will describe optional arguments in one of two ways:
[,optional-argument]
or
,[optional-argument]
If the comma appears outside of the brackets, you must pass a zero by value or
use the OMITTED phrase to indicate the place of the omitted argument.
If the comma appears inside the brackets, you can omit the argument as long as
it is the last argument in the list.
For example, look at the optional arguments of a hypothetical routine,
LIB$EXAMPLE_ROUTINE:
LIB$EXAMPLE_ROUTINE arg1 [,arg2] [,arg3] [,arg4]
You can omit the optional arguments without using a placeholder:
CALL "LIB$EXAMPLE_ROUTINE"
USING ARG1
GIVING RET-STATUS.
However, if you omit an optional argument in the middle of the argument list,
you must insert a placeholder:
CALL "LIB$EXAMPLE_ROUTINE"
USING ARG1, OMITTED, ARG3
GIVING RET-STATUS.
In general, Run-Time Library routines use the [,optional-argument] format, while
system services use the ,[optional-argument] format.
In passing arguments to the procedure, you must define the passing mechanism
required if it is not the default. The default passing mechanism for all COBOL
data types is BY REFERENCE.
The passing mechanism required for a system routine argument is indicated in
the argument description. The passing mechanisms allowed in system routines
are those listed in the OpenVMS Calling Standard.
If the passing mechanism expected by the routine or service differs from the
default mechanism in COBOL, you must override the default. To force an
argument to be passed by a specific mechanism, refer to the following list:
•
If the argument is described as ‘‘the address of,’’ use BY REFERENCE, which
is the default.
•
If the argument is described as ‘‘the value of,’’ use BY VALUE.
•
If the argument is described as ‘‘address of descriptor,’’ use BY DESCRIPTOR.
Note
If a routine requires a passing mechanism that is not supported by
COBOL, calling that routine from COBOL is not possible.
13–12 Using Compaq COBOL in the Alpha Common Language Environment
Содержание COBOL AAQ2G1FTK
Страница 22: ......
Страница 30: ......
Страница 94: ......
Страница 110: ......
Страница 146: ......
Страница 180: ......
Страница 194: ...Processing Files and Records 6 1 Defi...
Страница 300: ......
Страница 490: ......
Страница 516: ......
Страница 517: ......
Страница 530: ......
Страница 534: ......
Страница 590: ......
Страница 620: ......