beautypg.com

Compaq COBOL AAQ2G1FTK User Manual

Page 468

background image

Using Compaq COBOL in the Alpha Common Language Environment
13.4 Calling Routines

Although you can call most system routines as a procedure call, it is
recommended that you do so only when the system routine does not return a
value. By checking the condition value, you can avoid errors.

The OpenVMS Alpha documentation on system services and Run-Time Library
routines contains descriptions of each system routine and a description of the
condition values returned. For example, the RETURNS section for the system
routine LIB$STAT_TIMER follows:

RETURNS

OpenVMS
usage:
type:
access:
mechanism:

cond_value
longword (unsigned)
write only
by value

Because LIB$STAT_TIMER returns a value, it should be called as a function. If
a system routine contains the following description under the RETURNS section,
you should call the system routine as a procedure call:

RETURNS

None.

13.4.2 Defining the Argument (OpenVMS)

Most system routines have one or more arguments. These arguments are used
to pass information to the system routine and to obtain information from it.
Arguments can be either required or optional, and each argument has the
following characteristics:

Access type (read, write, modify...)

Data type (floating point, longword...)

Passing mechanisms (by value, by reference, by descriptor...)

Argument form (scalar, array, string... )

To determine which arguments are required by a routine, check the format
description of the routine in the OpenVMS documentation on system services or
Run-Time Library routines. For example, the format for LIB$STAT_TIMER is as
follows:

LIB$STAT_TIMER

code ,value-argument [,handle-address]

The handle-address argument appears in square brackets ( [ ] ), indicating that it
is an optional argument. Hence, when you call the system routine LIB$STAT_
TIMER, only the first two arguments are required.

13–6 Using Compaq COBOL in the Alpha Common Language Environment