I need help for grouping the records in a file, not sure whether we can do this using sort/ICEtool.Here is my requirement.
I need to group the records in my input file based on few fileds in the file
Input file is 2000 bytes long.
Grouping based on
Group 1)
Only Unique records ,Key starts at 13 length 12 ( no duplicates )
Group 2)
All Records with same values in Position starting from 13 ,12 bytes long( char) and position starting from 62,20 bytes long( PD)
Group 3)
All Records with same values in Position starting from 13 ,12 bytes long( char) and position starting from 62,10 bytes long( PD) and different values in position starting from 72,10 byte long (PD).
Group 4)
All Records with same values in Position starting from 13 ,12 bytes long( char) and position starting from 72,10 bytes long( PD) and different values in position starting from 62,10 byte long (PD).
Group 5)
All Records with Position startin from 13 ,12 bytes long( char) and different values in position starting from 62,20 bytes long( PD).
Expected Output file :-
The group name needs to be appended to the end of the each record and needs to be in sorted order based on group name and 13,12 as key.
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
Please show an example of the records in your input file (relevant fields only) and what you expect for output, for all of the different cases.
Quote:
62,20 bytes long( PD)
Do you really have 20-byte PD values? That would be 39 digits and would exceed DFSORT's limit of 31 digits for PD values. Are all of these PD values positive with the same sign (all C or all F), or can they be positive and negative or have some C signs and some F signs?
Quote:
The group name needs to be appended to the end of the each record
Where does the "group name" come from? Hopefully, your example will show this.
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
Your expected output attachment doesn't show any group numbers, so it doesn't help me figure out which records in your input example should go to which groups.
Could you please just show the example input records and output records inline here like this:
If there is only one record for the key (13,12) then it will fall in group 1 and if there are two records for the key (13,12) then it will fall in any of other groups depending on other key values.
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
It appears that your site has changed DFSORT's shipped default of SOLRF=YES to SOLRF=NO. This change is NOT recommended and can cause unwanted results as in your case. To use SOLRF, you can add the following to your job:
Code:
//DFSPARM DD *
OPTION SOLRF
/*
You might want to alert your System Programmers to DFSORT's recommendation against the change they made.
In the future, please post text inline rather than as downloads. Your downloads were not very readable for me (just a jumble of words instead of individual lines).
I was trying to decode what you are doing ? Can you just let me know why are you doing overlay or what is CTL1 and why in the CTL2 you are splicing the records...
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
I'm using OVERLAY and SPLICE to create one record for each pair of keys that has the data for the first record of the pair in positions 1-2000 and the data for the second record of the pair in positions 2001-4000. For example:
Code:
first DDD... rcd | second DDD... rcd
1-2000 | 2001-4000
DDD... 5000 | DDD... 5000 |
Once we have the data for each pair of records in a single record, we can use INCLUDE to compare the PD values on the two sides and add the correct group number.
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:
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
Quote:
In the CTL2 you are you building a 4005 byte record ?
No - I'm building 2005 byte records for the various cases.
Code:
BUILD=(1,2000,C'CASE5',/,2001,2000,C'CASE5'))
This uses the "combined" record as input and splits it back into two parts. The first record has positions 1-2000 (original first record with each key) followed by 'CASE5' and the second record has 2001-4000 (original second record with each key) followed by 'CASE5'. The / means start a new record.
Apart from Key in postion 13, 12 long I am going to have one more key field in 82nd postion which is 5 byte long packed decimal, (date field ex:- "20040804").
So I need to add this field also in the sort cards, but i am getting error 1when i am adding this field in the RESTART of seq number.
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
khamarutheen,
The restart parm needs the keys to be contiguous bytes. So you need to pad the keys together. Change your CTL1CNTL to the following and re-run your job.