View previous topic :: View next topic
|
Author |
Message |
David P
Active User
Joined: 11 Apr 2005 Posts: 106 Location: Cincinnati Ohio
|
|
|
|
I have got an input file in the format mentioned below:
Code: |
Key1 - Amount 1
Key1 - Amount 2
Key1 - Amount 3
Key2 - Amount 1
Key2 - Amount 2
Key2 - Amount 3 |
I need an output in the format
Code: |
Key1 - Amount k1
Key1 - Amount k1
Key1 - Amount k1
Key2 - Amount k2
Key2 - Amount k2
Key2 - Amount k2 |
where Amount k1 = Amount 1 +Amount 2 + Amount 3 for Key1
and Amount k2 = Amount 1 +Amount 2 + Amount 3 for Key2.
Can this be done using DFSORT? If yes then how?
thanks
David |
|
Back to top |
|
|
priyesh.agrawal
Senior Member
Joined: 28 Mar 2005 Posts: 1448 Location: Chicago, IL
|
|
|
|
Length of KEY & AMOUNT ???
Regards,
Priyesh. |
|
Back to top |
|
|
David P
Active User
Joined: 11 Apr 2005 Posts: 106 Location: Cincinnati Ohio
|
|
|
|
Hi Priyesh,
Here is the information that I missed
Key length 8 characters
Amounts 8 bytes packed decimal
Please let me know if I missed anything.
Thanks
David P. |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Here's a DFSORT/ICETOOL job that will do what you asked for. I assumed the key is in positions 1-8 and the PD amount is in positions 9-16 and that your input file has RECFM=FB and LRECL=16. You can change the job appropriately for other positions and attributes if necessary.
Code: |
//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD DSN=... input file (FB/16)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//CON DD DSN=*.T1,VOL=REF=*.T1,DISP=(OLD,PASS)
// DD DSN=*.IN,VOL=REF=*.IN,DISP=(OLD,PASS)
//OUT DD DSN=... output file (FB/16)
//TOOLIN DD *
SORT FROM(IN) TO(T1) USING(CTL1)
SPLICE FROM(CON) TO(OUT) ON(1,8,CH) WITHALL WITH(1,8)
/*
//CTL1CNTL DD *
SORT FIELDS=(1,8,CH,A)
SUM FIELDS=(9,8,PD)
/*
|
|
|
Back to top |
|
|
David P
Active User
Joined: 11 Apr 2005 Posts: 106 Location: Cincinnati Ohio
|
|
|
|
Thanks Frank.
I tried the JCL you posted and its working for me.
-thanks
David P. |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Glad I could help. |
|
Back to top |
|
|
|