View previous topic :: View next topic |
Author |
Message |
Vishwakiran Beginner
Joined: 29 Jun 2004 Posts: 11 Topics: 8 Location: Bangalore
|
Posted: Thu Oct 18, 2007 3:40 pm Post subject: Summation based on the fields using SORT/ICETOOL |
|
|
Hi Friends,
I have a requirement like below
Say my input file is like below. I want to sum the numbers for A,B,C..
A X 100
B Y 080
A Z 090
C S 025
B V 010
I want my out put file like below (The numbers summed)
A 190
B 090
C 025
Could you please guide me regarding the same. _________________ Regards,
Vishwakiran |
|
Back to top |
|
 |
krisprems Beginner

Joined: 13 Dec 2006 Posts: 101 Topics: 4 Location: india
|
Posted: Thu Oct 18, 2007 11:54 pm Post subject: |
|
|
Vishwakiran
This SORT JOB does what you want.
Code: | //*******************************************************
//STEP1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
A X 100
B Y 080
A Z 090
C S 025
----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
B V 010
/*
//SORTOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=(1,1,CH,A)
SUM FIELDS=(5,3,ZD)
OUTREC BUILD=(1,1,3:5,3)
/*
|
SORTOUT _________________ cHEERs
krisprems |
|
Back to top |
|
 |
Frank Yaeger Sort Forum Moderator

Joined: 02 Dec 2002 Posts: 1618 Topics: 31 Location: San Jose
|
Posted: Fri Oct 19, 2007 10:15 am Post subject: |
|
|
Vishwakiran,
Here's a DFSORT job that will do what you asked for:
Code: |
//S1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD *
A X 100
B Y 080
A Z 090
C S 025
B V 010
/*
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION ZDPRINT
SORT FIELDS=(1,1,CH,A)
SUM FIELDS=(5,3,ZD)
/*
|
krisprems,
The OUTREC statement isn't needed (I'm curious as to why you think it is).
Also, it's best to specify the ZDPRINT option in case it isn't the default. _________________ Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort |
|
Back to top |
|
 |
krisprems Beginner

Joined: 13 Dec 2006 Posts: 101 Topics: 4 Location: india
|
Posted: Fri Oct 19, 2007 10:19 am Post subject: |
|
|
Frank
Since you wont use the OUTREC in your SORT JCL your o/p would look like Code: | A X 190
B Y 090
C S 025
|
where as the Vishwakiran wants inthis format _________________ cHEERs
krisprems |
|
Back to top |
|
 |
Frank Yaeger Sort Forum Moderator

Joined: 02 Dec 2002 Posts: 1618 Topics: 31 Location: San Jose
|
Posted: Fri Oct 19, 2007 10:30 am Post subject: |
|
|
Oh, I see. I missed that.  _________________ Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort |
|
Back to top |
|
 |
krisprems Beginner

Joined: 13 Dec 2006 Posts: 101 Topics: 4 Location: india
|
Posted: Fri Oct 19, 2007 10:33 am Post subject: |
|
|
Quote: | Oh, I see. I missed that.
|
No problem, i miss hundred and one things and you come back with corrections, me giving you extra work.  _________________ cHEERs
krisprems |
|
Back to top |
|
 |
|
|