Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
As can be seen from the following, BUILD is nearly 10 years old.
BUILD is an alias of FIELDS (means it is another name for it, so operation is identical).
FIELDS is used in many places, and has more than one meaning. There is no need to confuse the use of FIELDS more by using it on INREC, OUTREC and to use OUTREC on OUTFIL when it has a perfectly reasonable alternative.
BUILD has only one meaning, and is used on INREC, OUTREC, OUTFIL and within IFTHEN on the same.
FIELDS will always exists, as it has since, as far as I know, the first release of IBM's first Mainframe SORT product.
However, let's not use it in sample code.
First infraction will be incur a small currency penalty to be paid into the "FIELDS Box" (if you know how a "Swear Box" works, this should be easy).
People who continue to use FIELDS will be forced to perform a series of simple joins using SPLICE instead of JOINKEYS, and further transgressions will lead to their WHEN=GROUP License revoked.
Note:
BUILD has also been available in SyncSort for many years, so the FIELDS Box applies to SyncSort as well.
Quote:
Summary of Changes for SC26-7523-01 z/OS Version 1 Release 6
(PTFs - December, 2004)
[...]
OUTFIL Enhancements
[...]
BUILD or OUTREC: The existing OUTREC parameter, or its new alias of BUILD,
allows you to reformat each record by specifying all of its items one by one.
BUILD or OUTREC gives you complete control over the items you want in your
reformatted OUTFIL records and the order in which they appear. You can delete,
rearrange and insert fields and constants.
[...]
INREC and OUTREC Enhancements
[...]
BUILD or FIELDS: The existing FIELDS parameter, or its new alias of BUILD,
allows you to reformat each record by specifying all of its items one by one.
BUILD or FIELDS gives you complete control over the items you want in your
reformatted INREC or OUTREC records and the order in which they appear.
You can delete, rearrange and insert fields and constants.
One more note:
SORT statements and parameters are used/applied/executed in the order defined by the utility logic;
the sequence of their execution doesn't depend on the order the statements appear under //SYSIN DD
1) BUILD from INREC
2) BUILD from OUTREC
3) BUILD from each of OUTFIL
Any of BUILD uses as its input the record format received from previous BUILD:
All OUTFIL BUILDs use the format defined by OUTREC BUILD, or by INREC BUILD, or they use the original/joined record format.
Code:
. . .
[ INREC BUILD=(...) ] - reformat the record just before SORT operation
SORT FIELDS=...
[ OUTREC BUILD=(...) ] - common reformat after SORT operation for all output datasets
[ OUTFIL FNAMES=(...),BUILD=(...) ] - extra reformat for different output datasets
[ OUTFIL FNAMES=(...),BUILD=(...) ] - extra reformat for different output datasets
[ OUTFIL FNAMES=(...),BUILD=(...) ] - extra reformat for different output datasets
END