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
 

 

MERGE two files but keeping the duplicates

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

New User


Joined: 08 Aug 2008
Posts: 19
Location: Chennai

PostPosted: Tue Nov 04, 2008 4:03 pm    Post subject: MERGE two files but keeping the duplicates
Reply with quote

Hi,

I have the following input files.

Input file 1:
-------------

AAAAA 001
BBBBB 002
CCCCC 003
CCCCC 003
CCCCC 003
CCCCC 003
DDDDD 004
EEEEEE 005
EEEEEE 005
EEEEEE 005
FFFFFF 006


Input File 2:
-------------
003 XXXXX
005 YYYYYY

I want the following output file.

Output File:
-------------
AAAAA 001
BBBBB 002
CCCCC 003 XXXXX
CCCCC 003 XXXXX
CCCCC 003 XXXXX
CCCCC 003 XXXXX
DDDDD 004
EEEEEE 005 YYYYYY
EEEEEE 005 YYYYYY
EEEEEE 005 YYYYYY
FFFFFF 006

I tried to achieve this with ICETOOL-SPLICE KEEPNODUPS option, I am not getting the required result. Can you suggest a solution for this.

Regards,
Jai
Back to top
View user's profile Send private message

Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Tue Nov 04, 2008 9:54 pm    Post subject:
Reply with quote

Jai,

You can use a DFSORT/ICETOOL job like the following to do what you asked for. I assumed your input files have RECFM=FB and LRECL=80, but the job can be changed appropriately for other attributes. (Note that I am copying file2 before file1.

Code:

//S1   EXEC  PGM=ICETOOL
//TOOLMSG   DD  SYSOUT=*
//DFSMSG    DD  SYSOUT=*
//IN1 DD *
AAAAA  001
BBBBB  002
CCCCC  003
CCCCC  003
CCCCC  003
CCCCC  003
DDDDD  004
EEEEEE 005
EEEEEE 005
EEEEEE 005
FFFFFF 006
/*
//IN2 DD *
003 XXXXX
005 YYYYYY
/*
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(MOD,PASS)
//OUT DD SYSOUT=*
//TOOLIN DD *
COPY FROM(IN2) TO(T1) USING(CTL1)
COPY FROM(IN1) TO(T1)
SPLICE FROM(T1) TO(OUT) ON(8,3,CH) KEEPNODUPS -
  WITHALL WITH(1,6)
/*
//CTL1CNTL DD *
  INREC BUILD=(8:1,10,80:X)
/*
Back to top
View user's profile Send private message
vjai6977

New User


Joined: 08 Aug 2008
Posts: 19
Location: Chennai

PostPosted: Wed Nov 05, 2008 10:32 am    Post subject:
Reply with quote

Hi Frank,

This is a good learning about 'WITHALL WITH' parameter how to make use of it with SPLICE. This workd out for me. Thanks for your solution.


Regards,
Jai
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 Unable to create multiple files using... mbattu COBOL Programming 3 Fri May 05, 2017 5:35 pm
This topic is locked: you cannot edit posts or make replies. Merge two files and update Trailer re... Yashashri JCL & VSAM 1 Thu May 04, 2017 12:54 pm
No new posts Dynamic split of files under groups sril.krishy DFSORT/ICETOOL 4 Mon Apr 17, 2017 1:09 pm
No new posts Compare two files and subtract values ameetmund DFSORT/ICETOOL 7 Fri Mar 31, 2017 3:35 pm
No new posts Append data from two files into a sin... Praveen04 DFSORT/ICETOOL 5 Thu Mar 16, 2017 7:29 pm


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