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

Using ICETOOL how to merge 2 files


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

New User


Joined: 05 Dec 2005
Posts: 79

PostPosted: Fri Dec 09, 2005 11:08 am
Reply with quote

Hi,

und code x(3)
A/C number 9(9)
Trans date x(10)
MS number 9(8)
dollar 9(4)V99
shares9(2)V99

In file1:

Fund Code A/C number Trans date MS number
----------------- ------------------ ----------------- ----------------
024 901238678 10/10/05 00000000
110 911123344 14/10/05 12330000
801 938765555 01/10/05 00000000
890 931293847 24/10/05 16783333

File2:


Fund Code A/C number Dollar Shares
----------------- ------------------ ----------- -----------
024 901238678 3000.00 12.33
110 911123344 1200.00 23.33
801 938765555 1250.20 33.03
932 903333847 3222.33 55.55
992 990022000 2222.25 02.11


Output file3 should be like this:

Fund code A/C no Trans date dollars shares
024 901238678 10/10/05 3000.00 12.33
110 911123344 14/10/05 1200.00 23.33
801 938765555 01/10/05 1250.20 33.03


Using Icetool, i want to merge file1 and file2 based on common fieldsfund code and account number.
Help me with code.
Back to top
View user's profile Send private message
pushpagiri

New User


Joined: 07 Jul 2005
Posts: 51

PostPosted: Fri Dec 09, 2005 12:21 pm
Reply with quote

hi Prabha,

TRy this code and let us know if there is any issue.

Code:
//DFSORT   EXEC PGM=ICETOOL                                       
//TOOLMSG  DD SYSOUT=*                                           
//DFSMSG   DD SYSOUT=*                                           
//IN1  DD DSN=input.PUSH.F13,DISP=SHR                           
//IN2  DD DSN=input.PUSH.F14,DISP=SHR                           
//T1   DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(MOD,PASS)   
//OUT  DD DSN=output.PUSH.F934,DISP=SHR                         
//TOOLIN   DD *                                                   
    COPY FROM(IN1) TO(T1) USING(CPY1)                             
    COPY FROM(IN2) TO(T1) USING(CPY2)                             
    SPLICE FROM(T1) TO(OUT) ON(1,13,CH)-                         
           WITHEACH WITH(24,12) USING(CPY3)                       
/*                                                               
//CPY1CNTL DD *                                                   
    OUTREC FIELDS=(1:1,22,80:X)                                   
/*                                                               
//CPY2CNTL DD *                             
    OUTREC FIELDS=(1:1,13,24:15,12,80:X)     
/*                                           
//CPY3CNTL DD *                             
   OUTFIL FNAMES=OUT,OUTREC=(1,80)           
/*         
Back to top
View user's profile Send private message
Prabha
Warnings : 2

New User


Joined: 05 Dec 2005
Posts: 79

PostPosted: Fri Dec 09, 2005 3:33 pm
Reply with quote

Thanks..its working now..

What does it mean 80:X??
Back to top
View user's profile Send private message
pushpagiri

New User


Joined: 07 Jul 2005
Posts: 51

PostPosted: Fri Dec 09, 2005 4:52 pm
Reply with quote

Hi,

Means filling spaces.
Code:
OUTREC FIELDS=(1:1,22,80:X)


Here the file is copied to a temp file.So we have to specify in some way, the maximum limit for records(here 80).that is why it is used.

We can do that in other way also.

Code:
OUTREC FIELDS=(1:1,22,23:58X)


(fill spaces from 23-80.)
if we don't specify this then there will be an error in SPLICE operation to OUT file,because the tmp file(T1) will be of unknown LRECL.

Try submitting the JOB without 80:X.
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: Fri Dec 09, 2005 9:59 pm
Reply with quote

Quote:
if we don't specify this then there will be an error in SPLICE operation to OUT file,because the tmp file(T1) will be of unknown LRECL.


Actually, without the 80:X, SPLICE will NOT report an error, but you won't get what you want. Here's what would happen with:

Code:

//CPY1CNTL DD *                     
    OUTREC FIELDS=(1:1,22)           
/*                                   
//CPY2CNTL DD *                     
    OUTREC FIELDS=(1:1,13,24:15,12) 
/*                                   
//CPY3CNTL DD *                     
   OUTFIL FNAMES=OUT                 


The first COPY with CPY1CNTL will set the LRECL of T1 to 22. Since T1 is a MOD data set, the second COPY with CPY2CNTL will use the LRECL of T1 set previously and truncate the records to 22 bytes. The SPLICE will use the 22 byte records from T1 and set the LRECL of OUT to 22.

Also, you don't need WITHEACH or CTL3CNTL. And the Fund and A/C fields are 12 bytes, not 13 bytes according to the description.

So this would be the DFSORT/ICETOOL job I'd use - OUT will have LRECL=34, although you could change that to something else if necessary by using CPY3CNTL with OUTFIL FNAMES=OUT,OUTREC=(1,34,n:X).

Code:

//S1   EXEC PGM=ICETOOL
//TOOLMSG  DD SYSOUT=*
//DFSMSG   DD SYSOUT=*
//IN1  DD DSN=...  input file1
//IN2  DD DSN=...  input file2
//T1   DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(MOD,PASS)
//OUT  DD DSN=...  output file
//TOOLIN   DD *
COPY FROM(IN1) TO(T1) USING(CPY1)
COPY FROM(IN2) TO(T1) USING(CPY2)
SPLICE FROM(T1) TO(OUT) ON(1,12,CH)-
  WITH(23,12)
/*
//CPY1CNTL DD *
  OUTREC FIELDS=(1:1,22,34:X)
/*
//CPY2CNTL DD *
  OUTREC FIELDS=(1:1,13,23:13,12)
/*
Back to top
View user's profile Send private message
fixdoubts

New User


Joined: 21 Oct 2005
Posts: 54

PostPosted: Tue Dec 13, 2005 7:33 pm
Reply with quote

HI,

I HAVE A DOUBT IN THIS PROCESS.

COPY FROM(IN1) TO(T1) USING(CPY1)
COPY FROM(IN2) TO(T1) USING(CPY2)

In the above steps dont u think the T1 temp file will be
over written by the IN2 file contents and will display nothing in the resultant file except the key part.

Regards,
Back to top
View user's profile Send private message
superk

Global Moderator


Joined: 26 Apr 2004
Posts: 4652
Location: Raleigh, NC, USA

PostPosted: Tue Dec 13, 2005 7:42 pm
Reply with quote

fixdoubts wrote:
In the above steps dont u think the T1 temp file will be
over written by the IN2 file contents and will display nothing in the resultant file except the key part.

No. Look closely at the disposition of the file:
Code:

//T1   DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(MOD,PASS)
Back to top
View user's profile Send private message
fixdoubts

New User


Joined: 21 Oct 2005
Posts: 54

PostPosted: Tue Dec 13, 2005 7:56 pm
Reply with quote

oh...

i didnt see...

thanks for correcting me.

Regards,
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 Write line by line from two files DFSORT/ICETOOL 7
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Shift left VB record without x00 endi... DFSORT/ICETOOL 11
No new posts Merge two VSAM KSDS files into third ... JCL & VSAM 6
No new posts how to calculate SUM value for VB fil... DFSORT/ICETOOL 1
Search our Forums:

Back to Top