Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

compare 2 file based on key+retain duplicates ICETOOL SPLICE

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
Hariharan BK

New User


Joined: 11 Sep 2011
Posts: 14
Location: India

PostPosted: Thu May 02, 2013 12:04 am    Post subject: compare 2 file based on key+retain duplicates ICETOOL SPLICE
Reply with quote

Hi!

I am working on an requirement where there are 2 files :
FILE 1 - have all accounts with other details and will appear with duplicates.
FILE 2 - have only the account list.

All records in file 1 should be written to o/p file (with dups), provided those accounts are matching with that of file 2.

File 1:

100 XXXXX
100 XXXXY
121 XXXRR
122 RREED

File 2:

100
121

o/p file expected:

100 XXXXX
100 XXXXY
121 XXXRR

Please advise on how to get this requirement done via DFSORT/ICETOOL (SPLICE).

I have tried using SPLICE options like 'WITHALL', 'WITHANY', 'WITHEACH' etc. but the duplicates are getting removed and only 1 record is appearing in output file when there are many in file 1... Please suggest.

Thanks,
Hari
Back to top
View user's profile Send private message

dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Thu May 02, 2013 12:38 am    Post subject:
Reply with quote

Hello and welcome to the forum,

You should post the code you are using and the diagnostic output from a run (including the messsage ids).

I suspect you do not need SPLICE, but a JOINKEYS.

There are also topics that do this available in the forum. Use the SEARCH feature (above).
Back to top
View user's profile Send private message
mistah kurtz

Active User


Joined: 28 Jan 2012
Posts: 268
Location: Room: TREE(3). Hilbert's Hotel

PostPosted: Thu May 02, 2013 10:34 am    Post subject:
Reply with quote

Hi Hari,

As d.sch. has already pointed out, you dont need a SPLICE but JOINKEYS.
Assuming that First three character is the key in both the files and you need all the data from file one only, and all the files are FB and LRECL=80, you can try this job:

Code:
//SRT01    EXEC PGM=SORT                                     
//SYSOUT   DD SYSOUT=*                                       
//SORTJNF1 DD *                                               
100 XXXXX                                                     
100 XXXXY                                                     
121 XXXRR                                                     
122 RREED                                                     
//SORTJNF2 DD *                                               
100                                                           
121                                                           
//*                                                           
//COMMON   DD SYSOUT=*                                       
//*                                                           
//SYSIN    DD *                                               
  JOINKEYS FILE=F1,FIELDS=(1,3,A)                             
  JOINKEYS FILE=F2,FIELDS=(1,3,A)                             
  JOIN UNPAIRED,F1,F2                                         
  OPTION COPY                                                 
  REFORMAT FIELDS=(F1:1,80,?)                                 
  OUTFIL FNAMES=COMMON,INCLUDE=(81,1,CH,EQ,C'B'),BUILD=(01,80)
/*


Output:
Code:
100 XXXXX
100 XXXXY
121 XXXRR
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7225

PostPosted: Thu May 02, 2013 3:28 pm    Post subject: Reply to: compare 2 file based on key+retain duplicates ICET
Reply with quote

The sample data shown is already sorted, so no need to let JOINKEYS do it again. By not specifying a JOIN statement, only "matched" records will be included, and the REFORMAT record can specify all the data needed from file F1.

Code:
  JOINKEYS FILE=F1,FIELDS=(1,3,A),SORTED,NOSEQCK
  JOINKEYS FILE=F2,FIELDS=(1,3,A),SORTED,NOSEQCK
  OPTION   COPY
  REFORMAT FIELDS=(F1:1,80)
  OUTFIL   FNAMES=COMMON
Back to top
View user's profile Send private message
Hariharan BK

New User


Joined: 11 Sep 2011
Posts: 14
Location: India

PostPosted: Thu May 02, 2013 5:45 pm    Post subject:
Reply with quote

Many thanks All (mistah kurtz)... It worked fine..

Apologies for not posting the code earlier, as there were environement issues in getting the code into this forum.

Anyways thanks again !!
Back to top
View user's profile Send private message
mistah kurtz

Active User


Joined: 28 Jan 2012
Posts: 268
Location: Room: TREE(3). Hilbert's Hotel

PostPosted: Thu May 02, 2013 7:03 pm    Post subject:
Reply with quote

Hi Hari..You're welcome..I think Bill's solution is simpler and more efficient as per your requirements.
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7225

PostPosted: Thu May 02, 2013 7:26 pm    Post subject: Reply to: compare 2 file based on key+retain duplicates ICET
Reply with quote

Hey, it is your solution, I've just "tweaked" it for the data shown.

JOINKEYS sorts each data file by default (with OPTION EQUALS).

If either or both of the files are already sorted, then you want to tell JOINKEYS not to Sort, and you can avoid "sequence checking" as well.

If only a match is needed, no need to deal with unmatched for either file. If there is no match marker to drop off, then the REFORMAT record can specify the full and complete output.

I'm sure there are many thousands of JOINKEYS "out there" which work, but which re-sort sorted files :-)
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm
No new posts File Aid to File Manager conversion murali3955 IBM Tools 4 Thu Nov 24, 2016 3:41 pm
No new posts Updating the counters after eliminati... PANDU1 DFSORT/ICETOOL 12 Mon Nov 21, 2016 9:47 am
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm
No new posts CICS Roll back partially - Need to re... dwijadas CICS 4 Wed Nov 16, 2016 4:30 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us