|
View previous topic :: View next topic
|
| Author |
Message |
ksouren007
New User
Joined: 30 Jun 2010 Posts: 85 Location: Toronto, ON
|
|
|
|
Hi,
I have the following requirement on which i need some help asap.
Input File 1 : (Will never have dups)
111
222
333
444
Input File 2 : (May or may not have dups and may or may not be in sorted manner)
222
222
111
666
666
555
Output File 1 :
333
444
Output file 2 :
555
666
I need to delete records from Input File 1 as mentioned in input file 2 and put the remaining records in output file 1. Any unmatched record from input file 2 like 555 in the example would go to the output file 2.
Inputs for i/p file 2 will user modified so it may not be in sorted order or unique. Again, if the input file 2 has duplicates which are not present in file 1 so it would appear in the o/p file 2 only once like 666. |
|
| Back to top |
|
 |
sqlcode1
Active Member
Joined: 08 Apr 2010 Posts: 577 Location: USA
|
|
|
|
Souren,
Please post your DFSort function level. Also please post RECFM and LRECL for both the input file. Is your input file1 always sorted on first 3 bytes?
Use this link to determine your DFSort function level :-
www.ibmmainframes.com/viewtopic.php?t=33389
Thanks, |
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Developer

Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Souren,
I assumed your input file has RECFM=FB and LRECL=80, but the jobs can be changed for other attributes.
If you have the DFSORT PTF for JOINKEYS, you can use a DFSORT job like the following.
| Code: |
//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//IN1 DD *
111
222
333
444
//IN2 DD *
222
222
111
666
666
555
//OUT1 DD DSN=... output file1 (FB/80)
//OUT2 DD DSN=... output file2 (FB/80)
//SYSIN DD *
JOINKEYS F1=IN1,FIELDS=(1,3,A)
JOINKEYS F2=IN2,FIELDS=(1,3,A)
JOIN UNPAIRED,F1,F2
REFORMAT FIELDS=(F1:1,80,F2:1,80,?)
OMIT COND=(161,1,CH,EQ,C'B')
INREC IFTHEN=(WHEN=(161,1,CH,EQ,C'1'),BUILD=(1,80,161,1)),
IFTHEN=(WHEN=(161,1,CH,EQ,C'2'),BUILD=(81,80,161,1))
SORT FIELDS=(1,3,CH,A)
SUM FIELDS=NONE
OUTFIL FNAMES=OUT1,INCLUDE=(81,1,CH,EQ,C'1'),BUILD=(1,80)
OUTFIL FNAMES=OUT2,INCLUDE=(81,1,CH,EQ,C'2'),BUILD=(1,80)
/*
|
If you don't have the DFSORT PTF for JOINKEYS, you can use an ICETOOL job like the following:
| Code: |
//S2 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN1 DD *
111
222
333
444
//IN2 DD *
222
222
111
666
666
555
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(MOD,PASS)
//OUT1 DD DSN=... output file1 (FB/80)
//OUT2 DD DSN=... output file2 (FB/80)
//TOOLIN DD *
COPY FROM(IN1) TO(T1) USING(CTL1)
SELECT FROM(IN2) TO(T1) ON(1,3,CH) FIRST USING(CTL2)
SELECT FROM(T1) TO(OUT1) ON(1,3,CH) NODUPS USING(CTL3)
/*
//CTL1CNTL DD *
INREC OVERLAY=(81:C'1')
/*
//CTL2CNTL DD *
INREC OVERLAY=(81:C'2')
/*
//CTL3CNTL DD *
OUTFIL FNAMES=OUT1,INCLUDE=(81,1,CH,EQ,C'1'),BUILD=(1,80)
OUTFIL FNAMES=OUT2,INCLUDE=(81,1,CH,EQ,C'2'),BUILD=(1,80)
/*
|
|
|
| Back to top |
|
 |
ksouren007
New User
Joined: 30 Jun 2010 Posts: 85 Location: Toronto, ON
|
|
|
|
Hi Frank,
We dont have DFSORT utility installed in our system so I tried the ICETOOL method and it went fine. It was a great help to me and Thanksss a lot for that!!
However one thing if you kindly clarify then i would be able to use the same for any future purpose
SELECT FROM(IN2) TO(T1) ON(1,3,CH) FIRST USING(CTL2)
When its putting a '2' tag on the matched records between this IN1 and IN2 files...what exactly this 'FIRST' keyword is doing? please advice.
Thanks Again for the prompt help!! |
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Developer

Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
| Quote: |
| We dont have DFSORT utility installed in our system |
Then why did you post in the DFSORT Forum? And why would you expect me to help you further if you don't have DFSORT? BTW, if you have Syncsort, you're using Syncsort's undocumented SYNCTOOL, rather than DFSORT's fully documented ICETOOL.
If you're using Syncsort, please post future questions in the JCL Forum and mention that you're using Syncsort. |
|
| Back to top |
|
 |
ksouren007
New User
Joined: 30 Jun 2010 Posts: 85 Location: Toronto, ON
|
|
|
|
| Apologize for that...I newly joined the forum and not much conversant with its different categories of forums...will take care in future..Thanks alot anyways! |
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|