Compaq COBOL AAQ2G1FTK User Manual

Page 484

Advertising
background image

Using Compaq COBOL in the Alpha Common Language Environment
13.6 Examples (OpenVMS)

Example 13–6 Using LIB$K_* and LIB$_* Symbols (OpenVMS)

identification division.
program-id. SETSYM.
environment division.

data division.
working-storage section.
01 LOCAL-SYM

pic S9(9) comp value external LIB$K_CLI_LOCAL_SYM.

01 GLOBAL-SYM pic S9(9) comp value external LIB$K_CLI_GLOBAL_SYM.
01 COND-VAL

pic S9(9) comp.

88 COND-NORMAL

value external SS$_NORMAL.

88 COND-AMBSYMDEF

value external LIB$_AMBSYMDEF.

procedure division.
1.

call "LIB$SET_SYMBOL" using

by descriptor "XSET*SYM"
by descriptor "Test1A"
by reference

LOCAL-SYM

giving

COND-VAL.

if

COND-AMBSYMDEF display "Ambiguous"

else if COND-NORMAL

display "OK"

else

display "Not OK".

2.

call "LIB$SET_SYMBOL" using

by descriptor "XSETS"
by descriptor "Test1B"
by reference

LOCAL-SYM

giving

COND-VAL.

if

COND-AMBSYMDEF display "Ambiguous"

else if COND-NORMAL

display "OK"

else

display "Not OK".

3.

call "LIB$SET_SYMBOL" using

by descriptor "XSETS"
by descriptor "Test1C"
by reference

GLOBAL-SYM

giving

COND-VAL.

if

COND-AMBSYMDEF display "Ambiguous"

else if COND-NORMAL

display "OK"

else

display "Not OK".

9.

stop run.

This uses the following macro,

libdef.mar

:

.TITLE libdef
$HLPDEF GLOBAL

; case sensitive!

.END

The program is compiled, linked, and run, as follows:

$ cobol setsym
$ macro libdef
$ link

setsym,libdef

$ run

setsym

OK
Ambiguous
OK
$ show symbol xset*

XSETS == "Test1C"
XSET*SYM = "Test1A"

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

Advertising