Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Merge two files into 3rd file

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: Merge two files into 3rd file
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

Site Director


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

PostPosted: Sun Jun 14, 2009 2:17 am    Post subject:
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: 1703
Location: Australia

PostPosted: Sun Jun 14, 2009 5:57 am    Post subject:
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: 6970
Location: porcelain throne

PostPosted: Sun Jun 14, 2009 7:29 am    Post subject:
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

Site Director


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

PostPosted: Sun Jun 14, 2009 8:47 am    Post subject:
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: 1703
Location: Australia

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

Hi Dick (Brenholtz),

this might explain it better than I can, http://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: 6970
Location: porcelain throne

PostPosted: Sun Jun 14, 2009 5:03 pm    Post subject:
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    Post subject: Reply to: Merge two files into 3rd file
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 Moderator


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

PostPosted: Mon Jun 15, 2009 6:02 am    Post subject:
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    Post subject: Reply to: Merge two files into 3rd file
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    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 ISSUE IN copying Sequential file reco... thesumitk JCL & VSAM 2 Wed Dec 13, 2017 3:07 pm
No new posts File Tailoring -- Temporary dataset i... samzee71 CLIST & REXX 3 Fri Dec 01, 2017 3:12 am
No new posts Rexx - File tailoring samzee71 CLIST & REXX 10 Thu Nov 30, 2017 10:47 pm
No new posts Compare VSAM files using DFSORT pshongal DFSORT/ICETOOL 5 Thu Nov 23, 2017 10:24 am
No new posts Moving a PS file as body of a mail! Vignesh Sid JCL & VSAM 4 Tue Nov 21, 2017 9:23 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us