beautypg.com

1 routines, procedures, and functions – Compaq COBOL AAQ2G1FTK User Manual

Page 463

background image

13

Using Compaq COBOL in the Alpha Common

Language Environment

The Compaq COBOL compiler is part of the common language environment. This
environment defines certain calling procedures and guidelines that allow you to
call programs written in different languages or prewritten system routines from
Compaq COBOL. You can call the following routine types from Compaq COBOL:

Subprograms written in other languages supported by Alpha

Run-Time Library routines

OpenVMS Alpha system services

Tru64 UNIX library routines

On Tru64 UNIX, your Compaq COBOL programs can also call routines written in
other languages, including system services routines on Tru64 UNIX. These calls
must conform to the Tru64 UNIX Calling Standard for Alpha Systems.

For information on Tru64 UNIX, refer to the Tru64 UNIX operating system
documentation. Alternatively, use the

man -k

command to search through the

man pages for topics. For example, to find all routines containing the string
‘‘curses,’’ enter the following command:

%

man -k curses

The operating system will display information similar to the following:

curses (3)

- Library that controls cursor movement and windowing

curses_intro (3)

- Introduction to the curses routines which optimizes

terminal screen handling and updating

restartterm (3)

- Restart terminal for curses application

13.1 Routines, Procedures, and Functions

The terms routine, procedure, and function are used throughout this chapter.
A routine is a closed, ordered set of instructions that performs one or more
specific tasks. Every routine has an entry point (the routine name) and optionally
an argument list. Procedures and functions are specific types of routines: a
procedure is a routine that does not return a value, whereas a function is a
routine that returns a value by assigning that value to the function’s identifier.
In COBOL, routines are also referred to as subprograms and called programs.

System routines are prewritten operating system routines that perform common
tasks, such as finding the square root of a number or allocating virtual memory.
You can call any system routine from your program, provided that COBOL
supports the data structures required to call the routine. The system routines
used most often are Run-Time Library routines and system services.

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