Previous | Contents | Index |
DISPLAY "Enter two dates in a row: " NO ADVANCING. ACCEPT INMESSAGE. MOVE 1 TO PTR. PERFORM DISPLAY-TWO 2 TIMES. GO TO DISPLAYED-TWO. DISPLAY-TWO. MOVE SPACES TO THEDATE. MOVE 0 TO FIELD-COUNT MONTH-COUNT DAY-COUNT YEAR-COUNT. UNSTRING INMESSAGE DELIMITED BY "-" OR "/" OR ALL " " INTO THEMONTH DELIMITER IN HOLD-DELIM COUNT MONTH-COUNT THEDAY DELIMITER IN HOLD-DELIM COUNT DAY-COUNT THEYEAR DELIMITER IN HOLD-DELIM COUNT YEAR-COUNT WITH POINTER PTR TALLYING IN FIELD-COUNT. INSPECT THEDATE REPLACING ALL " " BY "0". DISPLAY THEDATE " " PTR " " FIELD-COUNT " : " MONTH-COUNT "-" DAY-COUNT "-" YEAR-COUNT. DISPLAYED-TWO. EXIT. |
Enter two dates in a row: 6/13/87 8/15/87 870613 09 03 : 01-02-02 870815 21 03 : 01-02-02 Enter two dates in a row: 10 15 87-1 1 88 871015 10 03 : 02-02-02 880101 21 03 : 01-01-02 Enter two dates in a row: 6/13/87-12/31/87 870613 09 03 : 01-02-02 871231 21 03 : 02-02-02 Enter two dates in a row: 6/13/87-12/31 870613 09 03 : 01-02-02 001231 21 02 : 02-02-00 Enter two dates in a row: 6/13/87/12/31/87 870613 09 03 : 01-02-02 871231 21 03 : 02-02-02 |
The USE statement specifies Declarative USE procedures to handle input/output exceptions and errors. It can also specify procedures to be executed before the program processes a specific report group.
file-name
is the name of a file connector described in a file description entry in a Data Division. It cannot refer to a sort or merge file.group-data-name
is the name of a report group in a report group description entry in a Data Division. It must not appear in more than one USE statement.
*************************************************************** * This example assumes that SELECT and FD statements exist * for FILE1-SEQ, FILE1-RAN, FILE1-DYN and FILE1-EXT. * All three USE procedures are local to the program * that hosts this fragment. * At run-time if there is an exception on opening FILE1-RAN * or FILE1-DYN, FILE1-ERR section can be invoked. * If there is an exception on opening FILE1-SEQ, INPUT-ERR * section can be invoked. Since there is no USE procedure * declared for the EXTEND mode or for FILE1-EXT, * an exception on opening that file will cause an abnormal * termination of the program. Also, since FILE1-SEQ in the * fragment is not opened for OUTPUT mode, the OUTPUT-ERR USE * procedure is not eligible to be invoked here. *********************************************************** PROCEDURE DIVISION. DECLARATIVES. INPUT-ERR SECTION. USE AFTER STANDARD ERROR PROCEDURE ON INPUT. INP-1. DISPLAY "INVOKED USE PROCEDURE FOR INPUT". OUTPUT-ERR SECTION. USE AFTER STANDARD ERROR PROCEDURE ON OUTPUT. OUT-1. DISPLAY "INVOKED USE PROCEDURE FOR OUTPUT". FILE1-ERR SECTION. USE AFTER STANDARD ERROR PROCEDURE ON FILE1-RAN, FILE1-DYN. FILE1-1. DISPLAY "INVOKED USE PROCEDURE FOR FILES". END DECLARATIVES. MAIN-PROGRAM SECTION. P0. DISPLAY "***ENTERED USE TEST PROGRAM FRAGMENT***". OPEN INPUT FILE1-SEQ. OPEN OUTPUT FILE1-RAN. OPEN I-O FILE1-DYN. OPEN EXTEND FILE1-EXT. ... |
The WRITE statement releases a logical record to an output or input-output file. It can also position lines vertically on a logical page.
rec-name
is the name of a logical record described in the Data Division File Section. The logical record cannot be in a sort-merge file description entry.src-item
is the identifier of the data item that contains the data.advance-num
is an integer or the identifier of an unsigned data item described as an integer. Its value can be zero.top-of-page-name
is a mnemonic-name equated to C01 in the SPECIAL-NAMES paragraph of the Environment Division. It represents top-of-page and is equivalent to the PAGE phrase.stment
is an imperative statement executed when the relevant condition (end-of-page or invalid key) occurs.stment2
is an imperative statement executed when the relevant condition (not at end-of-page or not invalid key) occurs.
Sequential or Line Sequential (Alpha) Files
File Status |
File Organization |
Access Method |
Meaning |
---|---|---|---|
00 | All | All | Write is successful |
02 | Ind | All | Created duplicate primary or alternate key |
21 | Ind | Seq | Attempted key value not in prime key sort order (invalid key) |
22 | Ind, Rel | All | Duplicate key (invalid key) |
24 | Ind, Rel | All | Boundary violation (relative or indexed files) or relative record number is too large for relative key data item (invalid key) |
34 | Seq | Seq | Boundary violation (sequential files) |
44 | All | All | Boundary violation. An attempt was made to write a record that is larger than the largest or smaller than the smallest record allowed |
48 | All | All | File not open, or incompatible open mode |
92 | Ind, Rel | All | Record locked by another process |
30 | All | All | All other permanent errors |
HELP RMS $FLUSH |
Previous | Next | Contents | Index |