Hi..
I have multiple files(34 to be specific) which need to be sorted using one control card. The files will have Header, Detail and trailer records and Only detail records need to be sorted. Header and trialer records can be identified with A and Z in the first position of the record. All other records are detail records. I have used below JCL to sort only detail records.
Sample Data:
A12334
DDETAIL DATA123
MDETAIL DATA123
YDETAIL DATA123
Ztotal records 3
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
Have a look here. What are your DCBs and RECFMs? Can you concatenate the 34 files on one DD?
This topic was just a few below yours in the DFSORT forum. It seems to be common these days to just toss headers and trailers into the data without any thought for later sorting the file.
Code:
file header = key set low, indicator, data for file header
data header = key of data, indicator, data for data header
data = key of data, indicator, data
data trailer = key of data, indicator, data for data trailer
....
file trailer = key set high, indicator, data for file trailer
Then you can always sort the data without having to worry about where the headers/trailers are going to end up.
I have 34 different files which needed to be sorted to corresponding 34 output files. I can not concatenate them in one DD. I've no idea whether or not this can be achieved using SORT utility. Also, I had difficulties understanding the code given by you. Could you elucidate.
I need to have all headers and trailers intact. Only the detail data needs to be sorted. If I have the data in one of the files as below,
A12334
YDETAIL DATA123
MDETAIL DATA123
DDETAIL DATA123
Ztotal records 3
A12335
YDETAIL DATA124
MDETAIL DATA124
Ztotal records 2
Expected output needs to be
A12334
DDETAIL DATA123
MDETAIL DATA123
YDETAIL DATA123
Ztotal records 3
A12335
MDETAIL DATA124
YDETAIL DATA124
Ztotal records 2
Please note, not all files will have similar data. I mean, some files might have one just one header and trailer and some others might have multiple headers and trailers.
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
I wasn't giving code, I was saying that someone designed a system with at least 34 files without "internal integrity". If you drop them on the floor, or sort them, you have problems.
Fortunately for you, DFSORT/ICETOOL is an extremely flexible product which can drag your files from the mire. Is it going to do this every day? Who gets to pay for the poor design? Client, I guess.
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
Vamshi,
DATASORT is NOT the correct choice for this - it only deals with headers at the top and bottom, not in the middle.
The WHEN=GROUP technique is the correct way to do this. If you want to sort multiple files with ICETOOL, you would need multiple SORT operators.
You could use a DFSORT/ICETOOL job like the following: