Example 2

  SORT FIELDS=(18,5,ZD,D)
  OUTFIL FNAMES=(V,VBU1,VBU2)
  OUTFIL FNAMES=(F,FBU1),
    CONVERT,OUTREC=(11,3,X,18,5,X,X'0000000F')
  OUTFIL FNAMES=VINF,OUTREC=(1,4,C'*',5,20,C'*',25)
This example illustrates how multiple sorted output data sets can be created and how a variable-length record data set can be converted to a fixed-length record data set:
  • The first OUTFIL statement writes the variable-length input records to the variable-length OUTFIL data sets associated with ddnames V, VBU1, and VBU2.
  • The second OUTFIL statement reformats the variable-length input records to fixed-length output records and writes them to the fixed-length OUTFIL data sets associated with ddnames F and FBU1. CONVERT is used to indicate that a variable-length data set is to be converted to a fixed-length data set; OUTREC is used to describe how the variable-length input records are to be reformatted as fixed-length output records.
  • The third OUTFIL statement reformats the variable-length input records and writes them to the variable-length OUTFIL data set associated with ddname VINF. OUTREC is used to insert asterisks between fields. 1,4 represents the RDW. 25 represents the variable part at the end of the input record.