Using the SORT and MERGE Statements
9.1 Sorting Data with the SORT Statement
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.
Note
You cannot access records released to the sort-file after execution of the
SORT statement ends.
Using the SORT and MERGE Statements 9–5
Содержание COBOL AAQ2G1FTK
Страница 22: ......
Страница 30: ......
Страница 94: ......
Страница 110: ......
Страница 146: ......
Страница 180: ......
Страница 194: ...Processing Files and Records 6 1 Defi...
Страница 300: ......
Страница 490: ......
Страница 516: ......
Страница 517: ......
Страница 530: ......
Страница 534: ......
Страница 590: ......
Страница 620: ......