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

Merging two files based upon the key field


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

New User


Joined: 12 Mar 2008
Posts: 53
Location: Chennai

PostPosted: Tue Jun 16, 2009 5:35 pm
Reply with quote

Hi Guys,

Is there a solution for the scenario given below. I want it to be tried in DFSORT not with ICETOOL.

For Example,
File1
A
001
002
003
004
005

File2
A B
001 20
002 30
003 40
110 50
120 60
130 70

I want to merge both files based upon Field A. The output should contain all the records from File1. IF match found, the new field(B) should be populated from file2. If not, the new field should be populated as BLANK.
The resulting output should be,
Output
A B
001 20
002 30
003 40
004
005

Thanks
Ashok Kumar.K
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Tue Jun 16, 2009 7:03 pm
Reply with quote

ICETOOL is part of DFSORT
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Tue Jun 16, 2009 10:42 pm
Reply with quote

ashok4u_it,

Assuming both files have same dcb properties and the keys being unique, the following DFSORT JCL will give you the desired results

Code:

//STEP0100 EXEC PGM=SORT                                   
//SYSOUT   DD SYSOUT=*                                     
//SORTIN   DD *                                             
001 20                                                     
002 30                                                     
003 40                                                     
110 50                                                     
120 60                                                     
130 70                                                     
//         DD *                                             
001                                                         
002                                                         
003                                                         
004                                                         
005                                                         
//SORTOUT  DD SYSOUT=*                                     
//SYSIN    DD *                                             
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(81:C'00')),             
        IFTHEN=(WHEN=(5,1,CH,EQ,C' '),OVERLAY=(81:C'01'))   
  SORT FIELDS=(1,3,CH,A),EQUALS                             
  SUM FIELDS=(81,2,ZD)                                     
  OUTFIL INCLUDE=(81,2,ZD,EQ,1),BUILD=(1,80)               
/*                                                         
Back to top
View user's profile Send private message
senjay

Active User


Joined: 10 May 2007
Posts: 147
Location: India

PostPosted: Wed Jun 17, 2009 6:29 am
Reply with quote

Ashok,

Quote:

I want it to be tried in DFSORT not with ICETOOL


May I ask you why ICETOOL should not be used? If you don't know the reason, can you ask the person who told you not to use ICETOOL.

icon_mad.gif

as Expat said ICETOOL is a part of DFSORT
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 and retrive records f... DFSORT/ICETOOL 3
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
No new posts Write line by line from two files DFSORT/ICETOOL 7
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
Search our Forums:

Back to Top