My second field starts from position 9 if the length of the field is only 10 then i want to pad two
zeroes to the left.If length of the second field is 11 then i want to pad only one zero and if the length of field is 12 keep it as such and i want to put commas as shown in the example
Could you please suggest me a way to do this using sort
If you're not familiar with DFSORT and DFSORT's ICETOOL, 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:
ie, my second field length can be either 10,11 or 12,.If the second field is of length 10 i want to append 2 zeroes in left serperated by commas as shown in output file first record ie, if second field is 9153028018 then in my output file it should come as 0,0,91530,28018
If the second field is of length 11 i want to append 1 zeroes in left serperated by commas as shown in output file first record ie, if second field is 19153028018 then in my output file it should come as 0,1,91530,28018
If the second field is of length 12 my output file should be ie, if second field is 139153028018 then in my output file it should come as 1,3,91530,28018
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
Here's a DFSORT job that will do what you asked for. I assumed your input file has RECFM=FB and LRECL=80, but the job can be changed appropriately for other attributes.