Using the SORT and MERGE Statements
9.3 Sample Programs Using the SORT and MERGE Statements
Example 9–9 Using the INPUT PROCEDURE and OUTPUT PROCEDURE
IDENTIFICATION DIVISION.
PROGRAM-ID. SORTC.
*********************************************************
*
This program shows how to use the INPUT
*
PROCEDURE and OUTPUT PROCEDURE phrases of the
*
SORT statement. Input to the sort is two files
*
containing the same type of data. Records with
*
a "D" status-code are not released to the sort.
*
The program eliminates duplicate records by
*
adding their amounts to the amount in the first
*
record with the same account number. Only records
*
with unique account numbers are written to
*
the output file. The fields to be sorted are
*
S-KEY-1 and S-KEY-2. The sort sequence is amount
*
within account number.
Phrases
*
*
*
*
*
*
*
*
*
*
*
*
Need help?
Do you have a question about the COBOL AAQ2G1FTK and is the answer not in the manual?