Previous topic |
Next topic |
Contents |
Contact z/OS |
Library |
PDF
Reformatting records after sorting with BUILD or FIELDS z/OS DFSORT: Getting Started SC23-6880-00 |
||||||||||||||||||
In the last chapter, you used the SUM statement to sum the price of the books in stock and the books sold for each publisher. Now, using the FIELDS or BUILD parameter of the OUTREC statement, you can delete all the fields that are not needed for the application; in other words, fields whose contents are not meaningful in a summation record. Only the publisher, number-in-stock, and number-sold fields are written, reducing the output record length to 12 bytes. The OUTREC statement looks like this: Here are the steps for writing this OUTREC statement:
The SORT, SUM and OUTREC statements are as follows:
Table 2 shows the output.
The number in stock and number sold fields are binary values which would actually be unreadable if you printed or displayed the output records shown in Table 2. Later in this chapter, you'll learn how binary and other unreadable numeric values can be converted to various readable forms. Suppose you use
this SORTOUT DD statement for your output data
set:
DFSORT automatically sets the LRECL of your new output data set (MY.OUTPUT) to the reformatted output record length, so LRECL=12 would be set in this case. You do not need to specify the LRECL on your SORTOUT DD statement, because DFSORT will set it appropriately for you. If your SORTOUT data set already has an LRECL value (OLD data set), or you choose to specify an LRECL value on the SORTOUT DD statement, that value overrides the value DFSORT would set for the LRECL. This can result, intentionally or unintentionally, in padding or truncating your output records if the calculated length of the reformatted record does not match your specified LRECL. In general, it is best to let DFSORT set the RECFM, LRECL and BLKSIZE for your NEW SORTOUT data sets, unless you have a particular reason to override these values. For OLD SORTOUT data sets, ensure that the existing RECFM, LRECL and BLKSIZE values are appropriate for the control statements you use. |
Copyright IBM Corporation 1990, 2014
|