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

How to Merge 2 columns from two diff DSN & put into 1 DS


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

New User


Joined: 21 Feb 2012
Posts: 8
Location: india

PostPosted: Wed Feb 22, 2012 6:13 pm
Reply with quote

File 1:


20120219
20120219
20120219
20120219
20120219

File 2:

12
13
15
18
19


Outfile should be:

20120219 12
20120219 13
20120219 15
20120219 18
20120219 19
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Wed Feb 22, 2012 6:36 pm
Reply with quote

go to ftp.software.ibm.com/storage/dfsort/mvs/sorttrck.pdf

and look at Join fields from two files record-by-record
Back to top
View user's profile Send private message
elango_K

New User


Joined: 18 Aug 2011
Posts: 44
Location: India

PostPosted: Wed Feb 22, 2012 8:42 pm
Reply with quote

On what basis is the mapping done.

Will the rec count always match in both files???
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Wed Feb 22, 2012 8:46 pm
Reply with quote

Quote:
On what basis is the mapping done.

like many other topics posted recently the join is on the <sequence> number
at least that' s what it is reasonable to assume when the TS wisely icon_wink.gif forgets to tell about a common key
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


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

PostPosted: Wed Feb 22, 2012 11:51 pm
Reply with quote

Shanth,

You can use a DFSORT job like the following to do what you asked for:

Code:

//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//IN1 DD *
20120219
20120219
20120219
20120219
20120219
/*
//IN2 DD *
12
13
15
18
19
/*
//SORTOUT DD SYSOUT=*
//SYSIN DD *
  JOINKEYS F1=IN1,FIELDS=(9,8,A),SORTED,NOSEQCK
  JOINKEYS F2=IN2,FIELDS=(3,8,A),SORTED,NOSEQCK
  REFORMAT FIELDS=(F1:1,8,F2:1,2)
  OPTION COPY
  OUTREC BUILD=(1,8,15:9,2)
/*
//JNF1CNTL DD *
  INREC OVERLAY=(9:SEQNUM,8,BI)
/*
//JNF2CNTL DD *
  INREC OVERLAY=(3:SEQNUM,8,BI)
/*
Back to top
View user's profile Send private message
iniyavan555
Currently Banned

New User


Joined: 21 Feb 2012
Posts: 8
Location: india

PostPosted: Thu Feb 23, 2012 1:12 pm
Reply with quote

Code:


  JOINKEYS F1=IN1,FIELDS=(9,8,A),SORTED,NOSEQCK 
           *                                     
  JOINKEYS F2=IN2,FIELDS=(3,8,A),SORTED,NOSEQCK 
           *                                     
   REFORMAT FIELDS=(F1:1,8,F2:1,2)               
    OPTION COPY                                 
    OUTREC BUILD=(1,8,15:9,2)                   
WER268A  JOINKEYS STATEMENT: SYNTAX ERROR       
WER268A  JOINKEYS STATEMENT: SYNTAX ERROR       

i am getting the following Error for the above code which frank send
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Thu Feb 23, 2012 1:33 pm
Reply with quote

WER messages imply that You are using SYNCSORT

topic moved where it belongs
Back to top
View user's profile Send private message
bodatrinadh

Active User


Joined: 05 Jan 2007
Posts: 101
Location: chennai (India)

PostPosted: Thu Feb 23, 2012 1:51 pm
Reply with quote

Hello iniyavan555,

What Version/Release of Syncsort you are Using??

Thanks
-3nadh
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Thu Feb 23, 2012 3:14 pm
Reply with quote

Hi,

try this
Code:
//S1       EXEC PGM=SYNCTOOL                                     
//IN1      DD *                                                 
20120219                                                         
20120219                                                         
20120219                                                         
20120219                                                         
20120219                                                         
//IN2      DD *                                                 
12                                                               
13                                                               
15                                                               
18                                                               
19                                                               
//IN1O     DD DSN=&&IN1O,DISP=(,PASS,DELETE),UNIT=SYSDA,         
//            SPACE=(TRK,(10,5),RLSE)                           
//IN2O     DD DSN=&&IN2O,DISP=(,PASS,DELETE),UNIT=SYSDA,         
//            SPACE=(TRK,(10,5),RLSE)                           
//TOOLMSG  DD SYSOUT=*                                           
//DFSMSG   DD SYSOUT=*                                           
//TOOLIN   DD *                                       
  COPY FROM(IN1) TO(IN1O) USING(CTL1)                 
  COPY FROM(IN2) TO(IN2O) USING(CTL1)                 
/*                                                     
//CTL1CNTL DD *                                       
   INREC OVERLAY=(73:SEQNUM,8,ZD)                     
/*                                                     
//S2       EXEC PGM=SORT                               
//SYSOUT   DD SYSOUT=*                                 
//SORTJNF1 DD DSN=&&IN1O,DISP=(OLD,DELETE)             
//SORTJNF2 DD DSN=&&IN2O,DISP=(OLD,DELETE)             
//SORTOUT DD SYSOUT=*                                 
//SYSIN DD *                                           
  JOINKEYS FILE=F1,FIELDS=(73,8,A),SORTED             
  JOINKEYS FILE=F2,FIELDS=(73,8,A),SORTED             
  JOIN UNPAIRED                                       
  REFORMAT FIELDS=(F1:1,8,F2:1,2)                     
  OPTION COPY                                         
  OUTREC BUILD=(1,8,15:9,2)                           
/*



Gerry
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 Remote Unload of CLOB Columns DB2 6
No new posts Increase the number of columns in the... IBM Tools 3
No new posts Merge two VSAM KSDS files into third ... JCL & VSAM 6
No new posts DB2 Views with Multiple SQL & Col... DB2 8
This topic is locked: you cannot edit posts or make replies. Merge 2 input files based on the reco... JCL & VSAM 2
Search our Forums:

Back to Top