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

Merge two files key located in different position of i/p fil


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

Active User


Joined: 23 Feb 2006
Posts: 305
Location: Hyderabad,India

PostPosted: Tue Mar 13, 2007 7:26 pm
Reply with quote

Hi,

I need to merge two files into an output filoe.

For Ex: I have the following records in the First Input file

File 1:

KEY
ABCD XXXX
ABCE XXXX Key starts from 1 to 4
ABCF XXXX <<= We can assure that the file is sorted on KEY

File 2:
KEY
YYYYYYYY ABCD
FFFFFF ABCE Ket starts from 30 34
GGG ABCF <<= The file is sorted on the Key

I Expect the output as follows:

ABCD XXXX
YYYYYYYY ABCD
ABCE XXXX
FFFFFF ABCE
ABCF XXXX
GGG ABCF <<< All keys should be sorted

Please let me know how to code using ICETOOL??

~Vamsi
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: Tue Mar 13, 2007 10:08 pm
Reply with quote

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

Code:

//S1    EXEC  PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG  DD SYSOUT=*
//IN1 DD *
ABCD      XXXX
ABCE      XXXX
ABCF      XXXX
/*
//IN2 DD *
YYYYYYYY                     ABCD
FFFFFF                       ABCE
GGG                          ABCF
/*
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(MOD,PASS)
//OUT DD SYSOUT=*
//TOOLIN   DD    *
COPY FROM(IN1) TO(T1) USING(CTL1)
COPY FROM(IN2) TO(T1) USING(CTL2)
SORT FROM(T1) TO(OUT) USING(CTL3)
/*
//CTL1CNTL DD *
  INREC OVERLAY=(81:1,4)
/*
//CTL2CNTL DD *
  INREC OVERLAY=(81:30,4)
/*
//CTL3CNTL DD *
  OPTION EQUALS
  SORT FIELDS=(81,4,CH,A)
  OUTREC BUILD=(1,80)
/*
Back to top
View user's profile Send private message
shreevamsi

Active User


Joined: 23 Feb 2006
Posts: 305
Location: Hyderabad,India

PostPosted: Thu Mar 15, 2007 8:04 pm
Reply with quote

Hi Frank,

Ur code worked exactly whatz required,

Thanks alot
~Vamsi
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 INCLUDE OMIT COND for Multiple values... DFSORT/ICETOOL 5
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
Search our Forums:

Back to Top