It is abending with ABEND CODE=S0C7 and as you said I am using DFSORT.
But, I would like to understand the sort card better
INREC FIELDS=(1,4,347,5,PD,TO=BI,LENGTH=9)
1,4 => do we give for all the Variable block files ?
Where do we mention in the sort card to copy the remaining fieds?
Your INREC statement tells DFSORT that the output record should contain the RDW (in positions 1-4) and the converted 9 byte field.
347,5 means that the PD field starts in position 347 (counting the RDW in position 4). The 0C7 indicates you either got the positions for the PD field wrong, or there are invalid PD values in those positions.
You are not telling DFSORT to copy the remaining fields. If you want to insert the converted field and then copy the original data after it, the INREC statement would be:
INREC FIELDS=(1,4,347,5,PD,TO=BI,LENGTH=9,5)
If you want to do something else, you need to explain exactly what it is you want to do.
But you really need to understand DFSORT syntax before you can use it effectively. I'd suggest reading through "z/OS DFSORT: Getting Started". It's an excellent tutorial, with lots of examples, that will show you how to use DFSORT, DFSORT's ICETOOL and DFSORT Symbols. You can access it online, along with all of the other DFSORT books, from:
http://www.ibm.com/support/docview.wss? ... g3T7000080