Compaq COBOL AAQ2G1FTK User Manual
Page 247
Handling Input/Output Exception Conditions
7.3 Using File Status Values and OpenVMS RMS Completion Codes
Example 7–5 (Cont.) Referencing RMS-STS, RMS-STV, RMS-CURRENT-STS,
and RMS-CURRENT-STV Codes (OpenVMS)
PROCEDURE DIVISION.
A000-BEGIN.
.
.
WRITE RECORD-1 INVALID KEY PERFORM A901-REPORT-FILE1-STATUS.
*
*
The following PERFORM statement displays the RMS completion
*
codes resulting from the above WRITE statement for FILE-1.
*
PERFORM A903-REPORT-RMS-CURRENT-STATUS.
.
.
.
WRITE RECORD-2 INVALID KEY PERFORM A902-REPORT-FILE2-STATUS.
*
*
The following PERFORM statement displays the RMS completion
*
codes resulting from the above WRITE statement for FILE-2.
*
PERFORM A903-REPORT-RMS-CURRENT-STATUS.
.
.
.
*
*
The following PERFORM statement moves the RMS completion codes
*
resulting from the above WRITE statement for FILE-2 to data
*
fields that are explicitly defined within your program.
*
PERFORM A904-MOVE-RMS-STS-STV.
.
.
.
A901-REPORT-FILE1-STATUS.
*******************************************
*
DISPLAY "RMS-STS = " RMS-STS OF FILE-1 WITH CONVERSION.
DISPLAY "RMS-STV = " RMS-STV OF FILE-1 WITH CONVERSION.
DISPLAY "RMS-FILENAME = " RMS-FILENAME OF FILE-1.
*
*******************************************
PERFORM A999-GET-ANSWER UNTIL ANSWER = "Y" OR "N".
IF ANSWER = "N" STOP RUN.
A902-REPORT-FILE2-STATUS.
*******************************************
*
DISPLAY "RMS-STS = " RMS-STS OF FILE-2 WITH CONVERSION.
DISPLAY "RMS-STV = " RMS-STV OF FILE-2 WITH CONVERSION.
DISPLAY "RMS-FILENAME = " RMS-FILENAME OF FILE-2.
*
*******************************************
PERFORM A999-GET-ANSWER UNTIL ANSWER = "Y" OR "N".
IF ANSWER = "N" STOP RUN.
(continued on next page)
Handling Input/Output Exception Conditions 7–7