IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Merge two files into 3rd file


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
brganeshbabu

New User


Joined: 23 Jun 2005
Posts: 34
Location: Chennai

PostPosted: Sun Jun 14, 2009 1:22 am
Reply with quote

Hi,
I have two files FILE1 and FILE2 (ordinary PS). Both these files are in same format. I want to merge both these files into FILE3 such that if there is any duplicate record, only the record from FILE2 should be considered and not from FILE1. The key is first 10 characters, the Policy Number. I don't have ICETOOL. Can anyone tell me how to do this with ordinary SORT please ?
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


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

PostPosted: Sun Jun 14, 2009 2:17 am
Reply with quote

Hello,

If you have DFSORT, you have ICETOOL. . .

Run any sort and post the informational messages generated by the run including the message ids.
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Sun Jun 14, 2009 5:57 am
Reply with quote

Hi,

you can give this a try
Code:
//S1       EXEC PGM=SORT                                     
//SYSOUT   DD SYSOUT=*                                       
//SORTIN   DD DSN=FILE2                                     
//         DD DSN=FILE1                                     
//SORTOUT  DD DSN=FILE3                                     
//SYSIN    DD *                                             
  SORT FIELDS=(1,10,BI,A),EQUALS                             
  SUM FIELDS=NONE                                           
/*                                                           


Gerry
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Sun Jun 14, 2009 7:29 am
Reply with quote

Gerry,

I don't understand how sorting with EQUALS provides output to solve the TS's requirement?

Quote:
I want to merge both these files into FILE3 such that if there is any duplicate record, only the record from FILE2 should be considered and not from FILE1


Bold attributes by me.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


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

PostPosted: Sun Jun 14, 2009 8:47 am
Reply with quote

Hello,

From the doc. . .
Quote:
EQUALS specifies that the order of output records with equal control fields is to be based on the file number of the input data sets and the original order of the records within each input data set.
combined with the SUM FIELDS=NONE to discard all dups, should keep the first record from file 1.
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Sun Jun 14, 2009 10:01 am
Reply with quote

Hi Dick (Brenholtz),

this might explain it better than I can, ibmmainframes.com/viewtopic.php?t=41112&highlight=equals


Gerry
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Sun Jun 14, 2009 5:03 pm
Reply with quote

Hi guys,

I miss-read the SORTIN concatenation. [img]head-up-my-butt[/img]

Gerry, your suggestion is a solution.
Back to top
View user's profile Send private message
brganeshbabu

New User


Joined: 23 Jun 2005
Posts: 34
Location: Chennai

PostPosted: Sun Jun 14, 2009 7:12 pm
Reply with quote

Hi,
Thanks All. I will try tomorrow. I never knew ICETOOL is a part of DFSORT. I will learn it.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


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

PostPosted: Mon Jun 15, 2009 6:02 am
Reply with quote

ICETOOL has been a part of DFSORT since 1991!

Quote:
combined with the SUM FIELDS=NONE to discard all dups, should keep the first record from file 1.


Quote:
Gerry, your suggestion is a solution


It may or may not be a solution depending on what the OP actually wants to do which he hasn't described well enough for anyone to tell.

brganeshbabu,

It isn't clear what you want to do. Please show an example of the records in each input file (relevant fields only) and what you expect for output. If file1 can have duplicates within it, show that in your example. If file2 can have duplicates within it, show that in your example.
Back to top
View user's profile Send private message
brganeshbabu

New User


Joined: 23 Jun 2005
Posts: 34
Location: Chennai

PostPosted: Mon Jun 15, 2009 10:35 am
Reply with quote

Hi,

It's working fine. Thanks all ![/img]
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
Search our Forums:

Back to Top