View previous topic :: View next topic
|
Author |
Message |
Aaru
Senior Member
Joined: 03 Jul 2007 Posts: 1287 Location: Chennai, India
|
|
|
|
I have 2 input files and my requirement is as follows
Basically, first file’s key value (cols 7-16) should be compared with the key value (cols 7-16) in second file. If it is present, it has to be written in one output file and if not present, it will be written in another file.
File 1:
[img][/img]
File2:
[img][/img]
I have coded a JCL using the SPLICE parameter of ICETOOL.
Output that i got is
[img][/img]
If you look into the first set of input records there are two 2192260829. But, the output file is having only one 2192260829 (the first record from the first set. The second record is not coming in the output file).
Is there any way by which i can extract also the second record into the output file? |
|
Back to top |
|
|
Aaru
Senior Member
Joined: 03 Jul 2007 Posts: 1287 Location: Chennai, India
|
|
|
|
giving the file details agn as it dint get pasted
input file 1:
21966221922608292196624081AAB
21966221922608292196624081368
21966221922608282196626175368
21966221922608302196626175368
input file 2:
21966221922608282196620701KBC
21966221922608282196620702DEF
21966231922608282196620703DEF
21966241922608282196620704DEF
21966221922608282196620705111
21966221922608292196620706000
21966221922608282196626130368
21966221922608282196626143001
21966221922608282196626152368
21966221922608282196626174952
21966221922608282196626176520
21966221922608282196626177368
21966221922608282196626178ZYX
21966221922608282196626179368
21966221922608282196626181368
output file:
21966221922608292196624081AAB
21966221922608302196626175368 |
|
Back to top |
|
|
murmohk1
Senior Member
Joined: 29 Jun 2006 Posts: 1436 Location: Bangalore,India
|
|
|
|
Aaru,
Please let us know, wheter the IP files contain duplicate records? Also post your file attributes. |
|
Back to top |
|
|
Aaru
Senior Member
Joined: 03 Jul 2007 Posts: 1287 Location: Chennai, India
|
|
|
|
No, my input file does not contain duplicate records ! But it has got records with same value in the fields 7-16.
Input file1:
21966221922608292196624081AAB
21966221922608292196624081368
21966221922608282196626175368
21966221922608302196626175368
I need both these files in my output but not one ! All are FB with LRECL 80 ! |
|
Back to top |
|
|
krisprems
Active Member
Joined: 27 Nov 2006 Posts: 649 Location: India
|
|
|
|
Aaru
check the topic Create files with matching and non-matching records at [url]http://www.ibm.com/servers/storage/support/software/sort/mvs/tricks/ [/url] |
|
Back to top |
|
|
murmohk1
Senior Member
Joined: 29 Jun 2006 Posts: 1436 Location: Bangalore,India
|
|
|
|
Aaru,
Though the col 7-16 values are same for the records -
Quote: |
21966221922608292196624081AAB
21966221922608292196624081368 |
Second record is not found in your expected OP.
Give more examples and also post more info about your requirment. |
|
Back to top |
|
|
Aaru
Senior Member
Joined: 03 Jul 2007 Posts: 1287 Location: Chennai, India
|
|
|
|
Thanks a lot ! |
|
Back to top |
|
|
Aaru
Senior Member
Joined: 03 Jul 2007 Posts: 1287 Location: Chennai, India
|
|
|
|
Thanks kris for the link ! will try and let u know !
Meanwhile am listing down the requirements along with the input adn output file details as requested by murk!
input file 1:
21966221922608292196624081AAB
21966221922608292196624081368
21966221922608282196626175368
21966221922608302196626175368
input file 2:
21966221922608282196620701KBC
21966221922608282196620702DEF
21966231922608282196620703DEF
21966241922608282196620704DEF
21966221922608282196620705111
21966221922608292196620706000
21966221922608282196626130368
21966221922608282196626143001
21966221922608282196626152368
21966221922608282196626174952
21966221922608282196626176520
21966221922608282196626177368
21966221922608282196626178ZYX
21966221922608282196626179368
21966221922608282196626181368
output that i got
21966221922608282196626175368
21966221922608292196624081AAB
If you look into the first set of input records there are two 2192260829. But, the output file is having only one 2192260829 (the first record from the first set. The second record is not coming in the output file).
Expected output is:
21966221922608282196626175368
21966221922608292196624081AAB
21966221922608292196624081368 |
|
Back to top |
|
|
krisprems
Active Member
Joined: 27 Nov 2006 Posts: 649 Location: India
|
|
|
|
Aaru
Quote: |
If you look into the first set of input records there are two 2192260829. But, the output file is having only one 2192260829 (the first record from the first set. The second record is not coming in the output file).
|
Note that which ever file has the duplicate key's it should be the second i/p file.
Hope you got it! |
|
Back to top |
|
|
krisprems
Active Member
Joined: 27 Nov 2006 Posts: 649 Location: India
|
|
|
|
Aaru
Looks like your second i/p file also has duplicates.
So your case should be handled differently.
|
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Aaru,
Based on what you've said, here's a DFSORT/ICETOOL job that will do what you asked for:
Code: |
//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN1 DD *
21966221922608282196620701KBC
21966221922608282196620702DEF
21966231922608282196620703DEF
21966241922608282196620704DEF
21966221922608282196620705111
21966221922608292196620706000
21966221922608282196626130368
21966221922608282196626143001
21966221922608282196626152368
21966221922608282196626174952
21966221922608282196626176520
21966221922608282196626177368
21966221922608282196626178ZYX
21966221922608282196626179368
21966221922608282196626181368
//IN2 DD *
21966221922608292196624081AAB
21966221922608292196624081368
21966221922608282196626175368
21966221922608302196626175368
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(MOD,PASS)
//OUT1 DD DSN=... output file1
//OUT2 DD DSN=... output file2
//TOOLIN DD *
COPY FROM(IN1) TO(T1) USING(CTL1)
COPY FROM(IN2) TO(T1) USING(CTL2)
SPLICE FROM(T1) TO(OUT1) ON(7,10,CH) KEEPBASE KEEPNODUPS -
WITHALL WITH(1,81) USING(CTL3)
/*
//CTL1CNTL DD *
INREC OVERLAY=(81:C'BB')
/*
//CTL2CNTL DD *
INREC OVERLAY=(81:C'VV')
/*
//CTL3CNTL DD *
OUTFIL FNAMES=OUT1,INCLUDE=(81,2,CH,EQ,C'VB'),
BUILD=(1,80)
OUTFIL FNAMES=OUT2,INCLUDE=(81,2,CH,EQ,C'VV'),
BUILD=(1,80)
/*
|
OUT1 will have:
Code: |
21966221922608282196626175368
21966221922608292196624081AAB
21966221922608292196624081368
|
OUT2 will have:
Code: |
21966221922608302196626175368
|
|
|
Back to top |
|
|
Aaru
Senior Member
Joined: 03 Jul 2007 Posts: 1287 Location: Chennai, India
|
|
|
|
Thanks a lot and the code is working fine ! |
|
Back to top |
|
|
|