View previous topic :: View next topic
|
Author |
Message |
erdilverma
New User
Joined: 12 Sep 2007 Posts: 4 Location: Mumbai
|
|
|
|
File 1:-
CH12312**T1111
CH23123**T2222
CH22255**T4444
CH25525**T2222
File2:-
T1111
T4444
Output should contain:-
CH23123**T2222
CH25525**T2222
Removing those one that is present in File2. |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
You can use a DFSORT JOINKEYS job like the following to do what you asked for:
Code: |
//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//IN1 DD *
CH12312**T1111
CH23123**T2222
CH22255**T4444
CH25525**T2222
//IN2 DD *
T1111
T4444
//SORTOUT DD SYSOUT=*
//SYSIN DD *
JOINKEYS F1=IN1,FIELDS=(10,5,A)
JOINKEYS F2=IN2,FIELDS=(1,5,A)
JOIN UNPAIRED,F1,ONLY
OPTION COPY
/*
|
For complete details on JOINKEYS, see:
www.ibm.com/support/docview.wss?rs=114&uid=isg3T7000174 |
|
Back to top |
|
|
erdilverma
New User
Joined: 12 Sep 2007 Posts: 4 Location: Mumbai
|
|
|
|
Hi Frank,
Thanks for the help.
But I want the F1 file should not get in SORTed order.
The code which you mentioned is SORTing the F1 file. |
|
Back to top |
|
|
superk
Global Moderator
Joined: 26 Apr 2004 Posts: 4652 Location: Raleigh, NC, USA
|
|
|
|
I can attest that Frank's code gives the output as you showed:
CH23123**T2222
CH25525**T2222
which is the same order as the input. |
|
Back to top |
|
|
erdilverma
New User
Joined: 12 Sep 2007 Posts: 4 Location: Mumbai
|
|
|
|
Hi Kelvin,
Actually I have mentioned only small data. In my file I am having thousands of records. Suppose I change the example as
File 1:-
CH12312**T1111
CH23123**T2222
CH22255**T4444
CH25525**T3333
CH12225**T2222
File2:-
T1111
T4444
Output will come as:-
CH23123**T2222
CH12225**T2222
CH25525**T3333
But I want as:-
CH23123**T2222
CH25525**T3333
CH12225**T2222
File 1 order should not get changed. Only the record having ids present in File2 should get removed. |
|
Back to top |
|
|
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
erdilverma,
Use the following JCL which will give you the desired results
Code: |
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//IN1 DD *
CH12312**T1111
CH23123**T2222
CH22255**T4444
CH25525**T3333
CH12225**T2222
//IN2 DD *
T1111
T4444
//SORTOUT DD SYSOUT=*
//SYSIN DD *
JOINKEYS F1=IN1,FIELDS=(10,5,A)
JOINKEYS F2=IN2,FIELDS=(1,5,A)
JOIN UNPAIRED,F1,ONLY
REFORMAT FIELDS=(F1:1,88)
SORT FIELDS=(81,8,CH,A)
OUTREC BUILD=(1,80)
//JNF1CNTL DD *
INREC OVERLAY=(81:SEQNUM,8,ZD)
//* |
|
|
Back to top |
|
|
|