Way back in week 36/2003 I wrote a tip about how to change data using DFSORT. Meantime new versions of DFSORT has emerged and one of them improved the possibilities of changing data significant. The statement types INREC, OUTREC and OUTFIL has been extented with the new options OVERLAY and IFTHEN.
Using my earlier tip I will rewrite the example from the earlier tip in order to use OVERLAY and IFTHEN:
Firstly it is no longer a requirement to use OUTFIL to get access to the more interesting options in OUTREC and INREC. Secondly you no longer need to build the whole record. OVERLAY takes care of this. You may use OVERLAY without IFTHEN. If you for instance need to replace position 11 to 14 with XXXX you can manage it with OUTREC OVERLAY=(11:C'XXXX'). OVERLAY replaces only selected parts of a record with new data while the rest of the record is unchanged. Thirdly it is much easier to understand what the purpose of a statement is. IFTHEN is in my view much more intuitive. Please note that OVERLAY used in IFTHEN can replace other positions than the positions tested on.
A peculiar detail in IFTHEN is the HIT=NEXT option. With HIT=NEXT all the following IFTHEN will be evaluated even though the IFTHEN with HIT=NEXT is fulfilled. There are many other possibilities which you may read about in DFSORT Application programming guide.