Developing Compaq COBOL Programs
1.4 Program Run Messages
Refer to the Compaq COBOL Reference Manual and the OpenVMS Record
Management Services Reference Manual for more information about RMS special
registers.
Examples 1–5 and 1–6 show how you can use RMS special registers to detect
errors.
Example 1–5 Using RMS Special Registers to Detect Errors (OpenVMS)
IDENTIFICATION DIVISION.
PROGRAM-ID. RMS-SPEC-REGISTERS.
*
* This program demonstrates the use of RMS special registers to
* implement a different recovery for each of several errors with RMS files
*
ENVIRONMENT DIVISION.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT OPTIONAL EMP-FILE
ASSIGN TO "SYS$DISK:ART.DAT".
SELECT REPORT-FILE
ASSIGN TO "SYS$OUTPUT".
DATA DIVISION.
FILE SECTION.
FD
EMP-FILE
VALUE OF ID IS VAL-OF-ID.
01
EMP-RECORD.
02
EMP-ID
PIC 9(7).
02
EMP-NAME
PIC X(15).
02
EMP-ADDRESS
PIC X(30).
FD
REPORT-FILE
REPORT IS RPT.
WORKING-STORAGE SECTION.
01
VAL-OF-ID
PIC X(20).
01
END-OF-FILE
PIC S9(9)
COMP VALUE EXTERNAL RMS$_EOF.
01
BADNAME
PIC S9(9)
COMP VALUE EXTERNAL SS$_BADFILENAME.
01
FILE-NOT-FOUND
PIC S9(9)
COMP VALUE EXTERNAL RMS$_FNF.
01
DIR-NOT-FOUND
PIC S9(9)
COMP VALUE EXTERNAL RMS$_DNF.
01
INV-DEVICE
PIC S9(9)
COMP VALUE EXTERNAL RMS$_DEV.
01
INV-FILE-ID
PIC S9(9)
COMP VALUE EXTERNAL RMS$_IFI.
01
RMS-ERR
PIC S9(9)
COMP VALUE EXTERNAL SHR$_RMSERROR.
01
D-DATE
PIC 9(6).
01
EOF-SW
PIC X.
88
E-O-F
VALUE "E".
88
NOT-E-O-F
VALUE "N".
01
VAL-OP-SW
PIC X.
88
VALID-OP
VALUE "V".
88
OP-FAILED
VALUE "F".
01
OP
PIC X.
88
OP-OPEN
VALUE "O".
88
OP-CLOSE
VALUE "C".
88
OP-READ
VALUE "R".
(continued on next page)
1–56 Developing Compaq COBOL Programs
Содержание COBOL AAQ2G1FTK
Страница 22: ......
Страница 30: ......
Страница 94: ......
Страница 110: ......
Страница 146: ......
Страница 180: ......
Страница 194: ...Processing Files and Records 6 1 Defi...
Страница 300: ......
Страница 490: ......
Страница 516: ......
Страница 517: ......
Страница 530: ......
Страница 534: ......
Страница 590: ......
Страница 620: ......