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
 

 

Using ICETOOL how to merge 2 files

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: Using ICETOOL how to merge 2 files
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    Post subject:
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    Post subject: Re: Using ICETOOL how to merge 2 files
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    Post subject:
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 Moderator


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

PostPosted: Fri Dec 09, 2005 9:59 pm    Post subject:
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    Post subject:
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

Moderator Team Head


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

PostPosted: Tue Dec 13, 2005 7:42 pm    Post subject:
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    Post subject:
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    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 Using ICETOOL, how we can seperate th... bshkris SYNCSORT 5 Tue May 09, 2017 8:33 pm
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
No new posts Dynamic split of files under groups sril.krishy DFSORT/ICETOOL 4 Mon Apr 17, 2017 1:09 pm
No new posts Group elements using ICETOOL Learncoholic DFSORT/ICETOOL 2 Fri Apr 14, 2017 11:01 am


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