View previous topic :: View next topic
|
Author |
Message |
Jithucse
New User
Joined: 18 Apr 2008 Posts: 11 Location: Coimbatore
|
|
|
|
Hi,
I've a requirement like this. I need to get the sum of few numbers which are signed and are decimal numbers.
For example,
0314690| 0000001000.10
0314690|-0000002000.80
0314690| 0000000000.00
I need to sum up the amount fields and the result looks like as shown below.
0314690|-0000001000.70
Is there anyway this can be done by sort...
Regards,
Jithu |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Do you want one sum for all of the records? Or do you want a sum of the records for each key in positions 1-7? You only show one value in 1-7 so it's difficult to tell what you really want. A better example and explanation would help.
Also, what is the RECFM and LRECL of the input file? |
|
Back to top |
|
|
Jithucse
New User
Joined: 18 Apr 2008 Posts: 11 Location: Coimbatore
|
|
|
|
Hi,
I want the sum of records based on the value in the key position 1-7.
Here is an example to make it clear.
My input file is
0314690| 0000001000.10
0314690|-0000002000.80
0314695|-0000000500.50
0314690| 0000000000.00
0314695| 0000000500.50
And the output records looks like this
0314690|-0000001000.70
0314695| 0000000000.00
Also, the record format is FB and the LERCL is 22.
Regards,
Jithucse |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Here's a DFSORT job that will do what you asked for:
Code: |
//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=... input file (FB/22)
//SORTOUT DD DSN=... output file (FB/22)
//SYSIN DD *
OPTION EQUALS
SORT FIELDS=(1,7,CH,A)
OUTFIL REMOVECC,NODETAIL,
SECTIONS=(1,7,
TRAILER3=(1,8,
TOT=(9,14,SFF,EDIT=(STTTTTTTTTT.TT),SIGNS=(,-))))
/*
|
|
|
Back to top |
|
|
|