Example 9–1 (Cont.) INPUT and OUTPUT PROCEDURE Phrases
***********************************************************
* You can add, change, or delete records before sorting
* using COBOL data manipulation
* techniques.
***********************************************************
RELEASE SORT-RECORD.
GO TO 070-READ-INPUT.
100-DONE-INPUT SECTION.
110-EXIT-INPUT.
EXIT.
200-WRITE-OUTPUT SECTION.
210-OPEN-OUTPUT.
OPEN OUTPUT OUTPUT-FILE.
220-GET-SORTED-RECORDS.
RETURN SORT-FILE AT END
CLOSE OUTPUT-FILE
GO TO 230-DONE-OUTPUT.
MOVE SORT-RECORD TO OUTPUT-RECORD.
***********************************************************
* You can add, change, or delete sorted records
* using COBOL data manipulation
* techniques.
***********************************************************
WRITE OUTPUT-RECORD.
GO TO 220-GET-SORTED-RECORDS.
230-DONE-OUTPUT SECTION.
240-EXIT-OUTPUT.
EXIT.
You can combine the INPUT PROCEDURE with the GIVING phrases, or the
USING with the OUTPUT PROCEDURE phrases. In Example 9–2, the USING
phrase replaces the INPUT PROCEDURE phrase used in Example 9–1.
You cannot access records released to the sort-file after execution of the
SORT statement ends.
Using the SORT and MERGE Statements
9.1 Sorting Data with the SORT Statement
Note
Using the SORT and MERGE Statements 9–5
*
*
*
*
*
*
Need help?
Do you have a question about the COBOL AAQ2G1FTK and is the answer not in the manual?