z/OS DFSORT: Getting Started
Previous topic | Next topic | Contents | Contact z/OS | Library | PDF


Reformatting

z/OS DFSORT: Getting Started
SC23-6880-00

In Reformatting records with fixed fields and Reformatting records with variable fields, you learned how to use the INREC and OUTREC statements to reformat your input records in various ways while sorting, copying, or merging. You can also reformat your OUTFIL output records in the same ways using the PARSE, BUILD, OUTREC, OVERLAY, FINDREP, or IFTHEN parameters. VB data set considerations for the INREC and OUTREC statements also apply to the PARSE, BUILD, OUTREC, OVERLAY and IFTHEN parameters of OUTFIL statements.

Different PARSE, BUILD, OUTREC, OVERLAY or IFTHEN parameters can be used for different OUTFIL statements. You can use these parameters to perform the same wide variety of tasks as for the INREC and OUTREC statements, as described in Reformatting records with fixed fields and Reformatting records with variable fields.

In addition, you can use the BUILD, OUTREC, or IFTHEN BUILD parameters to create one, two or more output records from each input record, and insert blank lines before, between or after your records.

Suppose you wanted to create separate data sets for publishers FERN and WETH. For WETH, you want the number of copies sold and the instructor's name on one line. For FERN, you want the course number on one line and the price on another line. You also want two blank lines to separate the information for each book. You can use the following statements to create these two output data sets:
  OPTION COPY
  OUTFIL FNAMES=WETHBKS,
    INCLUDE=(106,4,CH,EQ,C'WETH'),
    OUTREC=(C'Sold ',166,4,BI,EDIT=(IIT),
            C' copies of Wethman, Inc. book for instructor ',
            160,2,X,145,15)
  OUTFIL FNAMES=FERNBKS,
    INCLUDE=(106,4,CH,EQ,C'FERN'),
    OUTREC=(3:C'Fernall Brothers book #',SEQNUM,2,ZD,
            C' for course ',115,5,/,
            5:C'costs ',170,4,BI,EDIT=($IIT.TT),2/)

The first OUTFIL statement uses an INCLUDE parameter to select the books for publisher WETH, and an OUTREC parameter to create the output records for each book with the needed information. The second OUTFIL statement uses an INCLUDE parameter to select the books for publisher FERN, and a different OUTREC parameter to create the output records for each book, with the needed information. Fields, constants, sequence numbers, and numeric editing are used in the OUTREC parameters as previously explained for the INREC and OUTREC statements.

/, n/ and /.../ can be used in the BUILD, OUTREC, or IFTHEN BUILD parameters of the OUTFIL statement, but not in the OVERLAY or IFTHEN OVERLAY parameters of the OUTFIL statement, or in any parameters of the INREC and OUTREC statements. If n/ is used at the start or end of the BUILD, OUTREC or IFTHEN BUILD parameters, n blank lines are inserted. If n/ is used in the middle of the BUILD, OUTREC or IFTHEN parameters, n-1 blanks lines are inserted.

Thus, in the OUTREC parameter for FERNBKS, the / (0 blank lines) in the middle after 115,5 is used to create two output records from each FERN input record, and the 2/ (two blank lines) at the end is used to insert two blank lines after the information for each FERN book.

The results produced for WETHBKS are:
Sold  26 copies of Wethman, Inc. book for instructor CL CHATTERJEE
Sold   9 copies of Wethman, Inc. book for instructor ST GOODGOLD
Sold  23 copies of Wethman, Inc. book for instructor DC SMITH
Sold  21 copies of Wethman, Inc. Book for instructor HR BISCARDI
The results produced for FERNBKS are:
  Fernall Brothers book #01 for course 00032
    costs  $26.00


  Fernall Brothers book #02 for course 00032
    costs   $3.60


  Fernall Brothers book #03 for course 10347
    costs   $6.25


  Fernall Brothers book #04 for course 30975
    costs  $26.00

DFSORT automatically sets the LRECL of each OUTFIL data set to the reformatted output record length. If n/ is used to create multiple output records from each input record, the LRECL is set to the longest output record.

For WETHBKS, the output record is 71 bytes long, so DFSORT sets the LRECL to 71. For FERNBKS, the first output record is 44 bytes long and the second output record is 17 bytes long, so DFSORT sets the LRECL to 44. If your reformatted length is shorter than you want for the LRECL, you can use c:X to increase the LRECL to c. For example, if you want the LRECL for FERNBKS to be 80 instead of 44, you can change the last line of the OUTREC parameter for FERNBKS to:
  5:C'costs ',170,4,BI,EDIT=($IIT.TT),80:X,2/)

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014