2 Best Ideas on How to Re-order fields with BUILD option in DFSORT

Search for Hot Linux Jobs -Apply Today
Linux is Hot IT Skill now a days

There are 2 ideas you can do re-order the fields in the output file.

Option -1 is you need to write a COBOL sort program. You need to code the fields how you want and write into output file. Click here to know sample COBOL sort program.

Option-2 is you need to use DFSORT commands in JCL.

Write the fields how you need in OUREC statement. The fields always appear in the order in which you specify them in the OUTREC.


SORT FIELDS=(106,4,CH,A) ==> Just sort the file based on fields specified.
SUM FIELDS=(162,4,BI,166,4,BI) ==> Sum up two fields and add to second field
OUTREC FIELDS=(106,4,166,4,162,4) or

OUTREC BUILD=(106,4,166,4,162,4)  ==> Here, you can write fields as you wish. So, you can easily do re-ordering with DFSORT without writing complex COBOL program logic.


Author: Srini

Experienced software developer. Skills in Development, Coding, Testing and Debugging. Good Data analytic skills (Data Warehousing and BI). Also skills in Mainframe.