Compaq COBOL AAQ2G1FTK User Manual
Page 475
Using Compaq COBOL in the Alpha Common Language Environment
13.4 Calling Routines
Even when you use the default passing mechanism, you can include the passing
mechanism that is used. For example, to call LIB$STAT_TIMER, you can use
either of the following definitions:
CALL "LIB$STAT_TIMER"
USING ARG-CODE, ARG-VALUE
GIVING RET-STATUS.
CALL "LIB$STAT_TIMER"
USING BY REFERENCE ARG-CODE, ARG-VALUE
GIVING RET-STATUS.
13.4.4.3 Calling a System Routine in a Procedure Call (OpenVMS)
If the routine or service you are calling does not return a function value or
condition value, you can call the system routine as a procedure. The same rules
apply to optional arguments; you must follow the calling sequence presented in
the FORMAT section of the OpenVMS Alpha documentation on system services
or Run-Time Library routines.
One system routine that does not return a condition value or function value is the
Run-Time Library routine LIB$SIGNAL. LIB$SIGNAL should always be called
as a procedure, as shown in the following example:
01 ARG-VALUE PIC S9(5) COMP VALUE 90.
.
.
.
CALL "LIB$SIGNAL" USING BY VALUE ARG-VALUE.
13.4.5 Checking the Condition Value (OpenVMS)
Many system routines return a condition value that indicates success or failure;
this value can be either returned or signaled. In general, system routines return
a condition value with the following exceptions:
•
The system routine returns a function value.
•
The CONDITION VALUES RETURNED is None.
•
There is no CONDITION VALUES RETURNED description, but rather a
CONDITION VALUES SIGNALED description. (Success conditions are not
signaled.)
•
The call to the routine was made as a procedure call.
If any of these conditions apply, there is no condition value to check.
If there is a condition value, you must check this value to make sure that it
indicates successful completion. All success condition values are listed in the
CONDITION VALUES RETURNED description.
Condition values indicating success always appear first in the list of condition
values for a particular routine, and success codes always have odd values. A
success code common to many system routines is the condition value SS$_
NORMAL, which indicates that the routine completed normally and successfully.
You can reference the condition values symbolically in your COBOL program by
specifying them in the EXTERNAL phrase of the VALUE IS clause. Symbolic
names specified in VALUE IS EXTERNAL become link-time constants; that is,
the evaluation of the symbolic name is deferred until link time because it is
known only at link time.
Using Compaq COBOL in the Alpha Common Language Environment 13–13