Compaq COBOL AAQ2G1FTK User Manual

Page 483

Advertising
background image

Using Compaq COBOL in the Alpha Common Language Environment

13.6 Examples (OpenVMS)

Example 13–5 Sample Run of CALLTIME (OpenVMS)

CALL SYS$ASCTIM
DATE/TIME 11-AUG-2000 09:34:33.45
LENGTH OF RETURNED = 0023

The following example shows how to call the procedure that enables and disables
detection of floating-point underflow (LIB$FLT_UNDER) from a COBOL program.
The format of the LIB$FLT_UNDER procedure is explained in the OpenVMS
RTL Library (LIB$) Manual
.

WORKING-STORAGE SECTION.
01

NEW-SET

PIC S9(9) USAGE IS COMP.

01

OLD-SET

PIC S9(9) USAGE IS COMP.

.
.
.

PROCEDURE DIVISION.

.
.
.

P0.

MOVE 1 TO NEW-SET.
CALL "LIB$FLT_UNDER" USING NEW-SET GIVING OLD-SET.

The following example shows how to call the procedure that finds the first clear
bit in a given bit field (LIB$FFC). This procedure returns a COMP longword
condition value, represented in the example as RETURN-STATUS.

WORKING-STORAGE SECTION.
01

START-POS

PIC S9(9) USAGE IS COMP VALUE 0.

01

SIZ

PIC S9(9) USAGE IS COMP VALUE 32.

01

BITS

PIC S9(9) USAGE IS COMP VALUE 0.

01

POS

PIC S9(9) USAGE IS COMP VALUE 0.

01

RETURN-STATUS

PIC S9(9) USAGE IS COMP.

.
.
.

PROCEDURE DIVISION.

.
.
.

CALL "LIB$FFC" USING START-POS,

SIZ,
BITS,
POS

GIVING RETURN-STATUS.

IF RETURN-STATUS IS FAILURE

THEN GO TO error-proc.

The following example uses LIB$SET_SYMBOL to set a value for a DCL symbol
and shows the use of LIB$K_* symbols for arguments and LIB$_* symbols for
return status values.

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

Advertising