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

Merge: column x is equal to that of column a my output


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Kijo

New User


Joined: 22 Mar 2007
Posts: 9
Location: Philippines

PostPosted: Wed Aug 29, 2007 9:43 pm
Reply with quote

i have 2 flat files... the first contains columns a, b and c with 3 records, the other columns x and y with 5 records.

if the value of column x is equal to that of column a my output should be columns a, b, c and y with the same number of records as file 1...

file 1:

a123 b123 c123
a456 b456 c456
a789 b789 c789

file 2:

x123 y000
x222 y111
x456 y000
x789 y000
x888 y111

output:

a123 b123 c123 y000
a456 b456 c456 y000
a789 b789 c789 y000

any suggestions?

thank you very much!
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: Wed Aug 29, 2007 11:36 pm
Reply with quote

Hello,

What should happen if there are duplicate "keys" in either of the files?
Back to top
View user's profile Send private message
Kijo

New User


Joined: 22 Mar 2007
Posts: 9
Location: Philippines

PostPosted: Thu Aug 30, 2007 9:07 am
Reply with quote

Hi,

there's no need to worry about dupes it will be taken care of by a previous job.
Back to top
View user's profile Send private message
shankar.v

Active User


Joined: 25 Jun 2007
Posts: 196
Location: Bangalore

PostPosted: Thu Aug 30, 2007 10:47 am
Reply with quote

Code:
// EXEC PGM=ICETOOL           
//DFSMSG DD SYSOUT=*           
//TOOLMSG DD SYSOUT=*         
//FILE1 DD *                   
123 123 123                   
456 456 456                   
789 789 789                   
/*                             
//FILE2 DD *                   
123 000                       
222 111                       
456 000                       
789 000                       
888 111                       
/*                             
//T DD DSN=&&T,DISP=(MOD,PASS)
//OUT DD SYSOUT=*             
//TOOLIN DD *                 
 COPY FROM(FILE1) TO(T)                         
 COPY FROM(FILE2) TO(T) USING(CTL1)             
 SPLICE FROM(T) TO(OUT) ON(1,3,CH) WITH(13,3)   
/*                                               
//CTL1CNTL DD *                                 
 INREC OVERLAY=(13:5,3)                         
/*                                               
//

Output:
Code:
123 123 123 000
456 456 456 000
789 789 789 000
Back to top
View user's profile Send private message
Kijo

New User


Joined: 22 Mar 2007
Posts: 9
Location: Philippines

PostPosted: Thu Aug 30, 2007 10:56 am
Reply with quote

thank you very much but is it also possible to do this with syncsort?
Back to top
View user's profile Send private message
shankar.v

Active User


Joined: 25 Jun 2007
Posts: 196
Location: Bangalore

PostPosted: Thu Aug 30, 2007 11:07 am
Reply with quote

Kijo,
Quote:
but is it also possible to do this with syncsort?

yes, it is possible in syncsort also.
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 -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Replacing 'YYMMDD' with date, varying... SYNCSORT 3
No new posts Sortjoin and Search for a String and ... DFSORT/ICETOOL 1
No new posts How to load to DB2 with column level ... DB2 6
No new posts RC query -Time column CA Products 3
No new posts Merge two VSAM KSDS files into third ... JCL & VSAM 6
Search our Forums:

Back to Top