Joined: 25 Mar 2007 Posts: 11 Topics: 4 Location: Switzerland
Posted: Tue Dec 08, 2009 12:53 pm Post subject: Create Total-Amount from two different keys
Hi all,
I'm trying to create a file with a new colums totals. One of the sum-calculation is negative:
This is an example from the input-file:
All numbers are in PD-format, length=16
Start-pos column 1: position 1
Start-pos column 2: position 8
Start-pos column 3: position 20 (PD, length=16)
Joined: 02 Dec 2002 Posts: 1618 Topics: 31 Location: San Jose
Posted: Tue Dec 08, 2009 7:46 pm Post subject:
What is the RECFM and LRECL of your input file?
Are you trying to get separate totals for each "key" in each of the two columns? Why do you get negative values from the positive values for the second column (e.g. Credit50 = 50 + 70 = -120 instead of +120?).
You need to do a better job of explaining the rules for getting from input to expected output.
Quote:
I cannot create a negative sum. (TOT=(160,16,PD))
You have to tell DFSORT how to format the total:
TOT=(160,16,PD,EDIT=(...),SIGNS=(...))
or
TOT=(160,16,PD,TO=FS)
depending on what you want the output to look like exactly. _________________ 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
Joined: 25 Mar 2007 Posts: 11 Topics: 4 Location: Switzerland
Posted: Wed Dec 09, 2009 12:49 am Post subject:
many thanks for the answer,
The input file has following format:
RECFM=FB
LRECL=200
Quote:
Are you trying to get separate totals for each "key" in each of the two columns? Why do you get negative values from the positive values for the second column (e.g. Credit50 = 50 + 70 = -120 instead of +120?).
Yes, absolute correct.
Reason:
One record means one booking (from the credit-account to the debit-account). We take the money from the credit-account (-/negativ) to the debit-account (+/positive).
Quote:
You need to do a better job of explaining the rules for getting from input to expected output.
The CTL1 (for the positve values, Debitx) works fine. I create a new column with the total from the input-values (the results are in the format PD)
The CTL2 does not work. I need to create the total from all values with Creditxx, but i need the negative value.
My idea for the negative value:
i create with "INREC OVERLAY" the negative sum at position 160:
The previous example had an error (position).
Now correct:
_________________ 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
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum