IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Sum two different columns in one step


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
vyasricha

New User


Joined: 17 Mar 2008
Posts: 27
Location: banaglore

PostPosted: Thu Feb 16, 2012 2:25 pm
Reply with quote

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
-------------------------------

Can any body guide me how to do this ?
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Fri Feb 17, 2012 12:34 am
Reply with quote

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?
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Remote Unload of CLOB Columns DB2 6
No new posts Return codes-Normal & Abnormal te... JCL & VSAM 7
No new posts Increase the number of columns in the... IBM Tools 3
No new posts How to append a PS file into multiple... JCL & VSAM 3
No new posts convert file from VB to FB and use tr... DFSORT/ICETOOL 8
Search our Forums:

Back to Top