Joined: 05 Jun 2009 Posts: 185 Location: Planet Earth
I have a input file of length 20 characters.
My sort conditions are,
1. Sort Key positions are : 2:3,20:1,5:12.
2. Omit the records which has certain values in the keys.
I achieved the above mentioned two points using the following step,
3. Now I also want to do one more level of filtering.
In the sorted output, If any continuous records have duplicate value for the key - (2:15,CH), then I want only the first record to get qualified.
Please find an example below,
Current Sorted Output & the desired record
Code:
11111111111111111111 Yes
11111111111111111111 No
11111111111111111113 No
11112222222222222223 Yes
11111111111111111114 Yes
11111111111111111115 No
11112222222222222225 Yes
11113333333333333336 Yes
Performing this in two steps is a easy option. But I am just curious to merge this along with the above mentioned step. And handle two different keys in a single step. Can anybody help me on this ??
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
I don't see how the input records you show match up with your SORT fields. But assuming you want to SORT on 2,3/20,1/5,12 in one case and you want to SORT on 2/15 in the other case:
You can do it in a single "step" using ICETOOL with two SORT operators.
But you can't do it in a single "pass" over the input file if that's what you're asking.
Joined: 05 Jun 2009 Posts: 185 Location: Planet Earth
Thanks for your reply Frank.
First of all I would like to clarify that I meant to ask for a single pass over the input file as you have specified.
Next, about the example shown and the input file, I am not sure where I was unclear about my SORT fields. Because below is the step that I used to test my case.
And yeah, as you have told this functionality is possible using ICETOOL and two operators in a single step. I achieved the same using the following JCL,
With that being said, I would like to clarify on why I asked for a single pass. I am actually trying to get this done for some elapsed time reduction. As having two passes will have an increased EXCP count and higher elapsed time compared to doing it in a single pass, I asked if there is a possibility of getting it done.
I would like to request your help in having a look at my ICETOOL step to see if it is the efficient (from elapsed time point of view) way of having my requirement done. Or is there a even better way of doing it ?
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
I'm not sure what you're trying to accomplish here. You started off by saying you want to do two different sorts, but your job only does one sort.
Quote:
RESTART=(2,15)
This will only work if the records are already sorted on 2,15 when you do the OUTFIL. If they are, then you don't need the second sort you mentioned or a second pass. If the records aren't already sorted on 2,15 when you do the OUTFIL, then this won't work.
If this works for you, then you don't need two passes. You can do the RESTART with an OUTREC statement and use an OUTFIL statement with INCLUDE and BUILD instead of a second pass.
Joined: 05 Jun 2009 Posts: 185 Location: Planet Earth
Frank,
Am sorry if I have mislead you with any of my wrong terminologies.
Quote:
Now I also want to do one more level of filtering.
In the sorted output, If any continuous records have duplicate value for the key - (2:15,CH), then I want only the first record to get qualified.
But from the above point, I just meant to say that if any successive records after the SORT has same values in the field (2,15) i want the records other than the first record to be omitted. And for this reason, I donot want the records to be sorted on (2,15).