hi ,
i have a file with 3 columns, i want to sum all 3 columns .
like eg , Input file
A B C
01 01 02 03
01 02 02 03
01 03 02 03
OUTPUT SHOULD BE :
----------------------------
01 06 06 09
---------------------------
all the three columns are packed decimal value ,
i am able to do for with indivisula columns but not able to do in one step.
//SYSIN DD *
INREC FIELDS=(1,3,4Z,163,4)
SORT FIELDS=(1,3,CH,A)
SUM FIELDS=(4,8,PD)
//
In this case my output is coming as
------------------------
01 06.00
----------------------
Value from file from 1-3 column and sum of values at 163 position.
but i want the o/p to be
----------------------------
01 06.00 06.00 09.00
-------------------------------
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
You can specify multiple PD fields in SUM, e.g.
Code:
SORT FIELDS=(1,3,CH,A)
SUM FORMAT=PD,FIELDS=(163,5,171,5,181,5)
However, you haven't explained clearly what you want to do so it's difficult to show you how to do it.
What is the starting position, length and format of your key (1,3,CH?). What is the starting position and length of each of your three packed decimal fields. Should the output totals be packed decimal, or in some other form (e.g. 'dd.dd')? You need to be specific. It would really help if you would show an example of your input fields in hex and what you expect for output.
Also, what is the RECFM and LRECL of your input file?