Previous Topic: Demonstration (3): Writing Complete RecordsNext Topic: Demonstration (5): Writing Variable-length Records


Demonstration (4): Writing Totals-only

Objective

This example writes a sorted totals-only report to a tape sequential file.

Procedure

A plus sign (+) inserted after CUST-NO indicates a control break, which prevents a blank record from being written each time the break occurs.

col. 2
▼
IN 80 F 400
REC CUST-NO       1     9  2
REC GROSS-AMT    10     9  2
REC NET          19     9  2
REC ITEM-NO      28    10  2
REC TYPE         38     3
010 DIFF
01OUT 40 4000 T PS(TAPE)
01SORT CUST-NO +    $Control break on CUST-NO
01510000 GROSS-AMT
01510000 NET
01510000 DIFF
017010   IF TYPE = ('E00' TO 'T99') DROP
017015   GROSS-AMT - NET  DIFF
01610001 CUST-NO     FN
01610010 GROSS-AMT   FZ
01610019 NET         FZ
01610028 DIFF        FZ SZ=11
018    IF LEVL EQ 2  DROP