Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

merge and sort two files

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: merge and sort two files
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 Moderator


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

PostPosted: Sat Feb 28, 2009 10:01 pm    Post subject:
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    Post subject:
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    Post subject:
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 Moderator


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

PostPosted: Mon Mar 23, 2009 9:47 pm    Post subject:
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    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts How to change 'K' or 'M' use Sort vice_versa DFSORT/ICETOOL 5 Thu May 18, 2017 7:11 am
No new posts Adding big TEXT lines to each record ... bshkris SYNCSORT 4 Sat May 06, 2017 1:40 am
No new posts Unable to create multiple files using... mbattu COBOL Programming 3 Fri May 05, 2017 5:35 pm
This topic is locked: you cannot edit posts or make replies. Merge two files and update Trailer re... Yashashri JCL & VSAM 1 Thu May 04, 2017 12:54 pm
This topic is locked: you cannot edit posts or make replies. SORT trick needed bshkris SYNCSORT 6 Tue May 02, 2017 4:35 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us