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

merge and sort two files


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

New User


Joined: 21 Nov 2007
Posts: 28
Location: chennai

PostPosted: Sat Feb 28, 2009 6:55 pm
Reply with quote

Hi Experts,

I have two files and both are of same length = 128

First file layout is as follows

Char1 Char3
(1-6) (43-62)
111111 AAAA...
999999 CCCC..
888888 FFFF...
222212 EEEE...

Second file layout is as follows

Char1 Char2
(1-11) (12-17)
32132132110 111111
12312312310 222212
11111111111 999999


The expected output as follows.

File2 sorted on Char1 along with file2.char2=file1.char1,file1.char3

11111111111999999CCCC..
12312312310222212EEEE..
32132132110111111AAAA...

I tried with ICETOOL but not getting the result as expected.
Pls find the cntl cards which i tried

Code:

//S1   EXEC  PGM=ICETOOL                                       
//TOOLMSG   DD  SYSOUT=*                                       
//DFSMSG    DD  SYSOUT=*                                       
//IN1 DD DSN=&id.FILE1,DISP=SHR               
//IN2 DD DSN=&id.FILE2,DISP=SHR                 
//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)                               
SPLICE FROM(T1) TO(OUT) ON(1,6,CH)-                             
  WITH(27,11)                                                     
/*                                                             
//CTL1CNTL DD *                                                 
  OUTREC FIELDS=(1:1,6,7:43,20,27:11X)                         
/*                                                             
//CTL2CNTL DD *                                                 
  OUTREC FIELDS=(1:12,6,27:1,11)                               
/*                                                             


Your help is greatly appreciated. Thanks in advance
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: Sat Feb 28, 2009 10:01 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 DSN=&id.FILE1,DISP=SHR  (FB/128)
//IN2 DD DSN=&id.FILE2,DISP=SHR  (FB/128)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(MOD,PASS)
//T2 DD DSN=&&T2,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//OUT DD SYSOUT=*  (FB/37)
//TOOLIN DD *
COPY FROM(IN1) TO(T1) USING(CTL1)
COPY FROM(IN2) TO(T1) USING(CTL2)
SPLICE FROM(T1) TO(T2) ON(12,6,CH) WITH(1,17)
SORT FROM(T2) TO(OUT) USING(CTL3)
/*
//CTL1CNTL DD *
  INREC BUILD=(12:1,6,18:43,20)
/*
//CTL2CNTL DD *
  INREC OVERLAY=(37:X)
/*
//CTL3CNTL DD *
  SORT FIELDS=(1,11,CH,A)
/*
Back to top
View user's profile Send private message
suresh1624

New User


Joined: 21 Nov 2007
Posts: 28
Location: chennai

PostPosted: Thu Mar 19, 2009 10:17 am
Reply with quote

Hi Frank,
Thanks for the quick reply. I couldn't see it for a long time. It's working.. thanks a ton.
Back to top
View user's profile Send private message
suresh1624

New User


Joined: 21 Nov 2007
Posts: 28
Location: chennai

PostPosted: Sat Mar 21, 2009 2:08 pm
Reply with quote

Hi Frank,
I tried with outrec the same thing but you preferred inrec.Is there any performance consideration between the two? Also can you pls tell me how to supress the key on which the files were merged.

for example the requirement was :

The expected output as follows.

File2 sorted on Char1 along with file2.char2=file1.char1,file1.char3

Code:
11111111111999999CCCC..
12312312310222212EEEE..
32132132110111111AAAA...



But how to write file2.char1 & file1.char3 only and supress file2.char2=file1.char1 in the result.

Thanks in advance
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: Mon Mar 23, 2009 9:47 pm
Reply with quote

Quote:
I tried with outrec the same thing but you preferred inrec.Is there any performance consideration between the two?


I wouldn't expect any difference. Why would you care if you used INREC or OUTREC?

Quote:
how to write file2.char1 & file1.char3 only and supress file2.char2=file1.char1 in the result.


I don't know what you mean by this. Please show an example of the records in each input file and what you expect for output. Please explain the rules for getting from input to output in English, not in some shorthand notation.
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 Need to set RC4 through JCL SORT DFSORT/ICETOOL 5
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Write line by line from two files DFSORT/ICETOOL 7
Search our Forums:

Back to Top