Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Sum two different columns in one step

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: Sum two different columns in one step
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 Moderator


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

PostPosted: Fri Feb 17, 2012 12:34 am    Post subject:
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    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Execute JCL step based on the content... sprikitik JCL & VSAM 2 Tue Oct 03, 2017 10:03 am
No new posts it is possible output a SET value fro... Martylin JCL & VSAM 5 Fri Sep 22, 2017 7:08 am
No new posts Restart=Step not working ALAK SAHA JCL & VSAM 6 Fri Jun 30, 2017 6:28 pm
No new posts Validate date and numeric fields and ... Rick Silvers DFSORT/ICETOOL 6 Thu May 11, 2017 6:51 pm
No new posts unload data from table with lob columns farhad_evan DB2 1 Sat Apr 22, 2017 1:32 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us