Previous Topic: Demonstration (4): Writing Totals-onlyNext Topic: Demonstration (6): Writing from the Database


Demonstration (5): Writing Variable-length Records

Objective

The following example reads in variable-length records and writes out variable-length records to a sequential file.

Procedure

Complete Code

col. 2
▼
IN 640 V                      $Variable-length file
REC CUST-NO        5       5      3  $Used as a sort key
REC TYPE          70       3         $Used in type 7 logic
REC PART-ONE       1     250
REC PART-TWO     251     250
REC PART-THREE   501     140
01SORT  CUST-NO
01OUT  640  D  PS
01510001 PART-ONE
01510251 PART-TWO
01510501 PART-THREE
017010  IF TYPE EQ ('E00' TO 'T99')  DROP