MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Merging files columnwise

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
Sebanpj
Beginner


Joined: 04 Aug 2008
Posts: 9
Topics: 5
Location: BANGALORE

PostPosted: Thu Mar 12, 2009 9:32 am    Post subject: Merging files columnwise Reply with quote

I have two files. Both the files are of same length and have the same fields, same number of rows. Let the file is having three fields(a,b,c) a is common in both the files(key).
In the output file, I want field a, field b from first file and field C from second file.

File 1
Code:
123A AAAA 999
123B BBBB 888
123C CCCC 777
123D DDDD 666


File 2
Code:
123A ZZZZ 111
123B YYYY 222
123C XXXX 333
123D WWWW 444


The output should be
Code:
123A AAAA 111
123B BBBB 222
123C CCCC 333
123D DDDD 444


Please help.
_________________
Thanks and Regards,
Sebastian Joseph
Back to top
View user's profile Send private message Send e-mail Visit poster's website
amargulies
Beginner


Joined: 10 Jan 2007
Posts: 123
Topics: 0

PostPosted: Thu Mar 12, 2009 10:19 am    Post subject: Reply with quote

Sebastian,

Here is a SyncSort for z/OS application that will produce your desired results:
Code:
//STEP1  EXEC PGM=SORT                           
//SORTJNF1 DD *                               
123A AAAA 999                                 
123B BBBB 888                                 
123C CCCC 777                                 
123D DDDD 666                                 
//SORTJNF2 DD *                               
123A ZZZZ 111                                 
123B YYYY 222                                 
123C XXXX 333                                 
123D WWWW 444                                 
//SORTOUT  DD SYSOUT=*                         
//SYSOUT   DD SYSOUT=*
//SYSIN    DD *                       
  JOINKEYS FILES=F1,FIELDS=(1,4,A)
  JOINKEYS FILES=F2,FIELDS=(1,4,A)
  REFORMAT FIELDS=(F1:1,10,F2:11,3)
  SORT FIELDS=COPY                 
/*                                 

_________________
Alissa Margulies
SyncSort Mainframe Product Services
201-930-8260
zos_tech@syncsort.com
Back to top
View user's profile Send private message Send e-mail
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Thu Mar 12, 2009 10:22 am    Post subject: Reply with quote

Sebastian,

Here's a DFSORT/ICETOOL job that will do what you asked for:

Code:

//S1   EXEC  PGM=ICETOOL
//TOOLMSG   DD  SYSOUT=*
//DFSMSG    DD  SYSOUT=*
//CON DD DSN=...  input file1
//    DD DSN=...  input file2
//OUT DD DSN=...  output file
//TOOLIN DD *
SPLICE FROM(CON) TO(OUT) ON(1,4,CH) WITH(11,3)
/*

_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group