Compaq COBOL AAQ2G1FTK User Manual

Page 469

Advertising
background image

Using Compaq COBOL in the Alpha Common Language Environment

13.4 Calling Routines

Once you have determined which arguments you need, read the argument
description for information on how to call that system routine. For example, the
system routine LIB$STAT_TIMER provides the following description of the code
argument:

code

OpenVMS
Usage:
type:
access:
mechanism:

longword_signed
longword integer (signed)
read only
by reference

Code that specifies the statistic to be returned. The code
argument contains the address of a signed longword
integer that is this code. It must be an integer from 1 to 5.

After you check the argument description, refer to Table 13–4 for the COBOL
equivalent of the argument description. For example, the code argument
description lists the OpenVMS Alpha usage entry longword_signed. To define
the code argument, use the COBOL equivalent of longword_signed:

01 LWS

PIC S9(9) COMP.

Follow the same procedure for the value argument. The description of value
contains the following information:

value-
argument

OpenVMS
Usage:
type:
access:
mechanism:

user_arg
longword (unsigned)
write only
by reference

The statistic returned by LIB$STAT_TIMER. The value-argument
argument contains the address of a longword or quadword
that is this statistic.

All statistics are longword integers

except elapsed time, which is a quadword.

For the value-argument argument, the OpenVMS Alpha usage, user_arg,
indicates that the data type returned by the routine is dependent on other
factors. In this case, the data type returned is dependent upon which statistic
you want to return. For example, if the statistic you want to return is code 5,
page fault count, you must use a signed longword integer. Refer to Table 13–4 to
find the following definition for a longword_signed:

01 LWS

PIC S9(9) COMP.

Regardless of which Run-Time Library routine or system service you call, you can
find the definition statements for the arguments in the OpenVMS Alpha usage in
Table 13–4.

13.4.3 Calling the External Routine (OpenVMS)

Once you have decided which routine you want to call, you can access the
routine using the CALL statement. You set up the call to the routine or service
the same way you set up any call in COBOL. To determine the syntax of the
CALL statement for a function call or a procedure call, see the Compaq COBOL
Reference Manual
, and refer to the examples in this chapter.

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

Advertising