Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

How to code the SUM Fields, If half of the field has spaces

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
chandrakanth_s

New User


Joined: 15 Mar 2006
Posts: 13

PostPosted: Fri Apr 06, 2007 2:37 am    Post subject: How to code the SUM Fields, If half of the field has spaces
Reply with quote

Hi,

I would like to aggregate Products field based on Dept. I tried using sum fields control statement. But I am getting SOC7 since there is the Products field. DEPT is a 4 byte field and Products is a 10 byte field, Out of 10 fields only two fields have decimal values the rest 8 bytes are spaces.

Expected Output is given below

Input:

Code:

Dept  Products
----------------
0001        11
0001        91
0002        11
0002        11
0003        81
0003        11
0003        11


Output

Code:

0001       102
0002       022
0003       103
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 Apr 06, 2007 3:07 am    Post subject:
Reply with quote

If your amount field is right-aligned, then you could use the following DFSORT statements and you wouldn't get an S0C7.

Code:

   OPTION ZDPRINT
   SORT FIELDS=(1,4,CH,A)
   SUM FIELDS=(5,10,ZD)


However, the output would not be what you want. It would be:

Code:

00010000000102
00020000000022
00030000000103


To get what you want you could use these DFSORT statements:

Code:

   SORT FIELDS=(1,4,CH,A)                         
   SUM FIELDS=(5,10,ZD)                           
   OUTREC OVERLAY=(5:5,10,ZD,EDIT=(IIIIIIITTT))   


The output would be:

Code:

0001       102
0002       022
0003       103
Back to top
View user's profile Send private message
chandrakanth_s

New User


Joined: 15 Mar 2006
Posts: 13

PostPosted: Fri Apr 06, 2007 7:29 pm    Post subject: Re: How to code the SUM Fields, If half of the field has spa
Reply with quote

Hi Frank,

Thanks for the help, it worked as expected.

Regards,
Chandrakanth
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 DB2 Program abending without giving a... rahulgarg14 DB2 3 Mon May 29, 2017 8:10 pm
No new posts Job failing with USER = 4093 REASON C... Pradeepa S ABENDS & Debugging 1 Wed May 17, 2017 3:35 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 READ A PACKED "NEGATIVE" FI... jdesouza CA Products 3 Tue May 02, 2017 11:43 pm
No new posts Sum Fields ballaswaroop DFSORT/ICETOOL 4 Tue May 02, 2017 11:07 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us