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
 

 

Merging two files based upon the key field

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: Merging two files based upon the key field
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: 8593
Location: Back in jolly old England

PostPosted: Tue Jun 16, 2009 7:03 pm    Post subject:
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    Post subject:
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    Post subject: Reply to: Merging two files based upon the key field
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    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 INVALID FIELD OR CONSTANT IN SORTOF ?? Ron Klop DFSORT/ICETOOL 8 Wed Jan 11, 2017 3:44 pm
No new posts Removing Duplicates based on certain ... chandracdac DFSORT/ICETOOL 8 Fri Dec 09, 2016 4:40 am
No new posts Performing arithmetic on input field zh_lad DFSORT/ICETOOL 31 Tue Dec 06, 2016 8:04 pm
No new posts High CPU consumption Job using IAM fi... aswinir JCL & VSAM 15 Thu Dec 01, 2016 8:28 pm
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


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