4 calling routines – Compaq COBOL AAQ2G1FTK User Manual

Page 467

Advertising
background image

Using Compaq COBOL in the Alpha Common Language Environment

13.3 OpenVMS Alpha System Routines (OpenVMS)

Table 13–3 (Cont.) System Services (OpenVMS)

Group

Types of Tasks Performed

Condition Handling

Designates condition handlers for special purposes

Event Flag

Clears, sets, reads, and waits for event flags, and associates with
event flag clusters

Information

Returns information about the system, queues, jobs, processes,
locks, and devices

Input/Output

Performs I/O directly, without going through RMS

Lock Management

Enables processes to coordinate access to shareable system
resources

Logical Names

Provides methods of accessing and maintaining pairs of character-
string logical names and equivalence names

Memory
Management

Increases or decreases available virtual memory, controls paging
and swapping, and creates and accesses shareable files of code or
data

Process Control

Creates, deletes, and controls execution of processes

Security

Enhances the security of OpenVMS Alpha systems

Timer and Time
Conversion

Schedules events and obtains and formats binary time values

13.4 Calling Routines

The basic steps for calling routines are the same whether you are calling a routine
(subprogram) written in COBOL, a routine written in some other language, a
system service, or a Run-Time Library routine. There are five steps required to
call any system routine:

1.

Determining the type of call

2.

Defining the arguments

3.

Calling the routine or service

4.

Checking the condition value, if applicable

5.

Locating the result

The following sections outline the steps for calling non-COBOL routines.

13.4.1 Determining the Type of Call (OpenVMS)

Before you call an external routine, you must first determine whether the call
should be a procedure call or a function call. In COBOL, a routine that does not
return a value should be called as a procedure call. A routine that returns a
value should be called as a function call. Thus, a function call returns one of the
following:

A function value (a COMP integer, COMP-1, or COMP-2 number). For
example, on OpenVMS Alpha the call LIB$INDEX returns an integer value.

A return status, which is a longword (PIC 9(5) to 9(9) USAGE IS COMP)
condition value that indicates the program has either successfully executed or
failed. For example, on OpenVMS Alpha, LIB$GET_INPUT returns a return
status.

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

Advertising