|
View previous topic :: View next topic
|
| Author |
Message |
Prabha Warnings : 2 New User
Joined: 05 Dec 2005 Posts: 79
|
|
|
|
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 |
|
 |
pushpagiri
New User
.jpg)
Joined: 07 Jul 2005 Posts: 51
|
|
|
|
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 |
|
 |
Prabha Warnings : 2 New User
Joined: 05 Dec 2005 Posts: 79
|
|
|
|
Thanks..its working now..
What does it mean 80:X?? |
|
| Back to top |
|
 |
pushpagiri
New User
.jpg)
Joined: 07 Jul 2005 Posts: 51
|
|
|
|
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 |
|
 |
Frank Yaeger
DFSORT Developer

Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
| 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 |
|
 |
fixdoubts
New User
Joined: 21 Oct 2005 Posts: 54
|
|
|
|
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 |
|
 |
superk
Global Moderator

Joined: 26 Apr 2004 Posts: 4652 Location: Raleigh, NC, USA
|
|
|
|
| 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 |
|
 |
fixdoubts
New User
Joined: 21 Oct 2005 Posts: 54
|
|
|
|
oh...
i didnt see...
thanks for correcting me.
Regards, |
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|