View previous topic :: View next topic
Author
Message
farouck New User Joined: 12 Apr 2006Posts: 18 Location: France
hi all,
I have one file :
1000 ABC DEF
2000 IJK LMN
3000 ABC EFG
1000 ABC DEF
2000 IJK OPQ
3000 ABC EFG
I want output file with duplicate records on 1,4 and changed data:
2000 OPQ
As 2000 has the same value on 5,3 i don't need IKJ.
Regards,
Back to top
loverj24 New User Joined: 05 Jul 2007Posts: 16 Location: bangalore
Hi Farouck,
Welocme to the forum.
Could you please give us a clear example of what you need, do you need to eliminate duplicates here?
Back to top
farouck New User Joined: 12 Apr 2006Posts: 18 Location: France
hi loverj24,
Yes i need to eliminate duplicates records for each but for each line too.
In my sample :
the lines 2000 are not duplicates because the 3th records is not the same
2000 IJK LMN
2000 IJK OPQ
But the second records is the same
Then i wants: 2000 OPQ
Back to top
Frank Yaeger DFSORT Developer Joined: 15 Feb 2005Posts: 7129 Location: San Jose, CA
Your description is still unclear and confusing.
You mean the "3rd value" - right?
Quote:
But the second records is the same
You mean the "second value" - right?
Please try to use the correct terminology to avoid confusion.
Quote:
As 2000 has the same value on 5,3 i don't need IKJ.
In your example, it looks like IKJ is at 6,3, not 5,3. Is there actually a blank between the fields or not?
What is the RECFM and LRECL of the input file? What is the starting position and length of each of the three fields?
A better example with more variations would help. For example, what do you expect for output with the following input records and why (assume the values for the three fields are in the correct positions)?
Code:
1000 ABC DEF
2000 IJK LMN
3000 ABC EFG
4000 XYZ ABC
5000 ABC DEF
1000 ABC DEF
2000 IJK OPQ
3000 ABC EFG
4000 MNO ABC
5000 CDE TUX
Back to top
farouck New User Joined: 12 Apr 2006Posts: 18 Location: France
hi frank,
I' m sorry if i don't be clear.
for this sample i wants :
Code:
2000 LMN
4000 XYZ
5000 ABC DEF
LRECL=23
RECFM=FB
First field on 1 to 4
second field on 6 to 8
third field on 10 to 12
Back to top
Arun Raj Moderator Joined: 17 Oct 2006Posts: 2481 Location: @my desk
farouck,
Do you have always 2 duplicate key records? Or the number can vary?
For e.g, Is the following input possible? If yes, what would be the output for that. Let me know if I got this wrong.
Code:
1000 ABC DEF
2000 IJK LMN
3000 ABC EFG
2000 IJK OPQ
3000 ABC EFG
2000 IJK STU
Back to top
farouck New User Joined: 12 Apr 2006Posts: 18 Location: France
hi Arcvns,
i have always 2 duplicate keys for the first records (not more).
Back to top
Frank Yaeger DFSORT Developer Joined: 15 Feb 2005Posts: 7129 Location: San Jose, CA
Here's a DFSORT job that will do what you asked for. You'll need z/OS PTF UK90013 (July, 2008) to use DFSORT's new WHEN=GROUP function. If you don't have that PTF, ask your System Programmer to install it (it's free).
Code:
//S1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=.. input file (FB/23)
//SORTOUT DD DSN=... output file (FB/23)
//SYSIN DD *
OPTION EQUALS
SORT FIELDS=(1,4,CH,A)
OUTREC IFTHEN=(WHEN=INIT,
BUILD=(1,4,24:SEQNUM,1,ZD,RESTART=(1,4),32:6,7)),
IFTHEN=(WHEN=GROUP,BEGIN=(24,1,CH,EQ,C'1'),
PUSH=(25:32,7))
OUTFIL INCLUDE=(24,1,CH,EQ,C'2',AND,25,7,CH,NE,32,7,CH),
IFOUTLEN=23,
IFTHEN=(WHEN=(25,3,CH,NE,32,3,CH),OVERLAY=(6:25,3),HIT=NEXT),
IFTHEN=(WHEN=(29,3,CH,NE,36,3,CH),OVERLAY=(10:29,3))
/*
For complete details on the DFSORT's new WHEN=GROUP function and the other new functions available with PTF UK90013, see:
Use [URL] BBCode for External Links
Back to top
farouck New User Joined: 12 Apr 2006Posts: 18 Location: France
Thanks you for the jcl, but this ptf is not applied.
I 'll take here with the next refresh in march.
Did you have the same jcl without Group.
Regards,
Back to top
Frank Yaeger DFSORT Developer Joined: 15 Feb 2005Posts: 7129 Location: San Jose, CA
Here's a DFSORT/ICETOOL job that will do what you want without WHEN=GROUP. Note that this job is less efficient than the WHEN=GROUP job.
Code:
//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD DSN=.. input file (FB/23)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//OUT DD DSN=... output file (FB/23)
//TOOLIN DD *
SORT FROM(IN) TO(T1) USING(CTL1)
SPLICE FROM(T1) TO(OUT) ON(1,4,CH) WITH(32,7) USING(CTL2)
/*
//CTL1CNTL DD *
OPTION EQUALS
SORT FIELDS=(1,4,CH,A)
OUTREC IFOUTLEN=38,
IFTHEN=(WHEN=INIT,
OVERLAY=(24:SEQNUM,1,ZD,RESTART=(1,4))),
IFTHEN=(WHEN=(24,1,CH,EQ,C'1'),
BUILD=(1,4,25:6,7)),
IFTHEN=(WHEN=NONE,
BUILD=(1,4,32:6,7))
/*
//CTL2CNTL DD *
OPTION COPY
OUTFIL FNAMES=OUT,
INCLUDE=(25,7,CH,NE,32,7,CH),
IFOUTLEN=23,
IFTHEN=(WHEN=(25,3,CH,NE,32,3,CH),OVERLAY=(6:25,3),HIT=NEXT),
IFTHEN=(WHEN=(29,3,CH,NE,36,3,CH),OVERLAY=(10:29,3))
/*
Back to top
Arun Raj Moderator Joined: 17 Oct 2006Posts: 2481 Location: @my desk
May be I am missing something here. In his first post the OP said he needed the fields from the modified records. But in his latest post, the required output has the initial values when a mismatch is found.
Back to top
farouck New User Joined: 12 Apr 2006Posts: 18 Location: France
For me it is the same, because i merge two files, the first value can be the modified value or the initial value.
Thanks a lot at franck for the solution.
Back to top
Arun Raj Moderator Joined: 17 Oct 2006Posts: 2481 Location: @my desk
Quote:
For me it is the same
I m sorry, still I am not clear. Consider the sample input posted by Frank. Are you saying that the below output is also acceptable?
Code:
2000 OPQ
4000 MNO
5000 CDE TUX
Back to top
farouck New User Joined: 12 Apr 2006Posts: 18 Location: France
With the sample and the jcl of franck my output is :
Code:
2000 LMN
4000 XYZ
5000 ABC DEF
But you are right, i changed the desired resultat in comparison with the beginning.
To have this ouput or your ouput is same for me because i can order the file as i wants.
I'm clear?
Lionel
Back to top
Frank Yaeger DFSORT Developer Joined: 15 Feb 2005Posts: 7129 Location: San Jose, CA
So to be clear, my job gives you the output you want - right?
Back to top
farouck New User Joined: 12 Apr 2006Posts: 18 Location: France
yes, your job is ok for me.
Thanks,
Back to top
Please enable JavaScript!