Using Compaq COBOL in the Alpha Common Language Environment
13.5 Establishing and Removing User Condition Handlers (OpenVMS)
To run this example program:
$ COBOL SSCOND
$ LINK
SSCOND
$ RUN
SSCOND
System service call failed with error:
%SYSTEM-F-IVCHAN, invalid I/O channel
%SYSTEM-F-SSFAIL, system service failure exception, status=0000013C,
PC=8005FA40, PS=0000001B
%TRACE-F-TRACEBACK, symbolic stack dump follows
Image Name
Module Name
Routine Name
Line Number
rel PC
abs PC
0 8005FA40
8005FA40
SSCOND
SSCOND
SSCOND
21 000000CC
000300CC
SSCOND
0 00020470
00030470
0 870C8170
870C8170
0 849708F0
849708F0
For more information about condition handling, including LIB$ESTABLISH and
LIB$REVERT, refer to OpenVMS RTL Library (LIB$) Manual.
♦
13.6 Examples (OpenVMS)
This section provides examples that demonstrate how to call system routines
from COBOL programs.
Example 13–2 shows a procedure call and gives a sample run of the program
RUNTIME. It calls MTH$RANDOM, a random number generator from the Run-
Time Library, and generates 10 random numbers. To obtain different random
sequences on separate runs, change the value of data item SEED for each run.
Example 13–2 Random Number Generator (OpenVMS)
IDENTIFICATION DIVISION.
PROGRAM-ID. RUNTIME.
*****************************************************
*
This program calls MTH$RANDOM, a random number
*
*
generator from the Run-Time Library.
*
*****************************************************
DATA DIVISION.
WORKING-STORAGE SECTION.
01 SEED
PIC 9(5) COMP VALUE 967.
01 A-NUM
COMP-1.
01 C-NUM
PIC Z(5).
PROCEDURE DIVISION.
GET-RANDOM-NO.
PERFORM 10 TIMES
CALL "MTH$RANDOM" USING SEED GIVING A-NUM
MULTIPLY A-NUM BY 100 GIVING C-NUM
DISPLAY "Random Number is
" C-NUM
END-PERFORM.
Example 13–3 shows a program fragment that calls the SYS$SETDDIR system
service.
Example 13–4 calls the System Service routine $ASCTIM.
Using Compaq COBOL in the Alpha Common Language Environment 13–19
Содержание COBOL AAQ2G1FTK
Страница 22: ......
Страница 30: ......
Страница 94: ......
Страница 110: ......
Страница 146: ......
Страница 180: ......
Страница 194: ...Processing Files and Records 6 1 Defi...
Страница 300: ......
Страница 490: ......
Страница 516: ......
Страница 517: ......
Страница 530: ......
Страница 534: ......
Страница 590: ......
Страница 620: ......