using dfsort or icetool i would like to have the output file as
12345,abc,cde,efg
5678912345,zaq,xswcde,vfrbgtnhy
Basically
1) the record starts with :20:---(values employee name)
2) the next record starts with :50: ---(values divided in 3 lines, this contains the address of employee in :20:)
3) the next again starts with :20:
the file is of lrec=80 and i want use dfsort to comma separate the values under :20: and :50: as employee,address
then the next record in output file as employee,address
Will there be anything in the :50: line or Is it just an indicator for the address line? Will there be any other values than :20: and :50: probably to indicate other fields than employee name and address? What is the max. field size for Employee Name and Employee Address field?
1) :20:( indicator to employee name can vary with length from 4 to max 20 char length
2) :50: ( indicator to address can very with length from 4 to 30 char ( inclusive of all spaces)
3) this address is split over 3 lines
ex :
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
sandeep badal,
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:
Sorry to bother again...but i got fixed with the solution provided...the input file is not consistent in the example i gave
The input file have
1) :20:( indicator to employee name can vary with length from 4 to max 20 char length
2) :50: ( indicator to address can very with length from 4 to 30 char ( inclusive of all spaces)
3) this address is split over 3 lines and in some cases 4 lines of address
All the above records having 3 lines of address worked fine but when we have a 4th line it gets truncated when we group records = 4 ...this gets selected and populated as a new record in the next line causing the mess for the rest of the records
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
Garbage in, garbage out. You said each address was 3 lines so I gave you a solution based on that.
If you can have groups with varying number of lines, that requires a different solution.
Note that your solution is more complicated than it needs to be. You don't have to add a dummy :70 tag or use END. You can just use BEGIN for :20 to group the records.
sandeep badal,
You don't need to create dummy record but rather use :20: to mark beginning of a group of lines representing "Address". Because now you have variable address lines(2 or 3 or 4 lines per address),you need to code for maximum address lines. Below solution assumes you could have max. of 4 lines per address. However, you can change it accordingly to handle more lines. I have also increased final LRECL to be 100 bytes.
Frank had almost given you everything to handle this situation. See if below works...