You must take a decision ...
change the sample output or change the description
Quote:
I just need in the output the recs that have a 'E' character, and this is not in the last rec for the recs with the same key.
from the description the output should be
Code:
00001 E
00004 E
or if You want the description to match the output You posted You should have written
... output the record groups for which exists an E record which is not the last one of the group ...
I have assumed that requrement as this :-
If the value 'E' is present for the last record of a block if same key
entire block of records will be neglected.
For this the jcl looks like this
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
gabriel.ryoga,
Assuming that there is always an E record in the group, here is a one pass DFSORT JCl which will give you the desired results removing the group which has E record as the last record. I assumed the file to be 80 bytes with FB RECFM
Code:
//STEP0100 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD *
00001 I
00001 E
00001 I
00003 I
00003 E
00004 E
00004 I
//OUT DD SYSOUT=*
//TOOLIN DD *
SPLICE FROM(IN) ON(1,5,CH) TO(OUT) WITHALL WITH(01,80) -
KEEPBASE KEEPNODUPS USING(CTL1)
//CTL1CNTL DD *
SORT FIELDS=(1,5,CH,A,81,8,CH,D)
INREC IFTHEN=(WHEN=INIT,OVERLAY=(81:SEQNUM,8,ZD,RESTART=(1,5))),
IFTHEN=(WHEN=(7,1,SS,EQ,C'EI'),OVERLAY=(89:7,1))
why not wait for the TS ( Thread started ) to clarify his wishes??
as I said in my previous post ...
the description asks for something, the sample is something else!
until then everything is just pure speculation
Hi Amar,
Even I faced this problem initially ..
But there is no problem with the logic what is suggested..
I don't know why it is not working..
There is some problem occuring whlie we do the INREC in the ctrl card.
some length issue which I am unable to understand.
So, the SPLICE statement is not producing the result what we are expecting
But when you change length of the input file from 80 to 100 or
add sequence no.at position 51 and letter 'E' at 59
Hi Amar,
looks like You have a duplicate post issue
maybe Your sort product is not that smart
I will delete the first one
this is the third one exactly with the same content
Sorry for misunderstanding. I don't have any duplicate post issue nor I have this kind of requirement . I was just trying out the issue and the solution JCL provided by Skolusu. But since the output was not matching with the required output by gabriel.ryoga. So I thought I will intimate the same to Skolusu. So I have posted my first reply for this thread.
vvmanyam,
I got this output with your suggestions.
Code:
00004 I
00004 E
I don't think its matching with the output required as the 00001 key records are out.Let Skolusu explain the output he got. He could have got correctly. There is some small thing gone wrong.
Yes you are correct. Its working.Actually I have changed the input records as below.
Code:
00001 I
00001 E
00003 I
00003 E
00001 I
00004 E
00004 I
Since the code is sorting the records based on the key in ascending order and then the sequence number in descending order. I just made a trail by giving this kind of input. Then it is skipping 00001 key records. I think it should not. Shouldn't it??
Hi Amar,
This case fails because we are adding the sequence no in the INREC which executes before sorting the data.
For above given input by you
we need to code a step which sort the data according to the key and then splice using the same control card.
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
V S Amarendra Reddy,
The solution I posted DOES produce the correct results eliminating the 0003 records. Trust me when I DO post a solution I post it after testing and getting the desired results. I have no idea as to why you don't get the same results without looking at your DFSMSG.
Probable reasons could be
1. You did not copy the control cards as is
2. You are NOT using DFSORT
3. Or you have a DFSORT version which does NOT support INREC processing with splice
Look at the ICE201I message . If you see a zero then your version does not support INREC processing with splice.
Quote:
ICE201I 0 RECORD TYPE IS F - DATA STARTS IN POSITION 1
If you have the latest PTF then the message would have an E
Quote:
ICE201I E RECORD TYPE IS F - DATA STARTS IN POSITION 1
Apologies!!!You are correct.I don't have latest PTFs. I just have seen my DFSMSG. You are perfect. I have seen the zero in ICE201I. So I think my shop doesn't have latest PTFs installed. So it is not supporting INREC with SPLICE.