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
This topic is locked: you cannot edit posts or make replies. how to code for GDG in Rexx cvnlynn CLIST & REXX 13 Wed Aug 09, 2017 9:13 pm
This topic is locked: you cannot edit posts or make replies. rexx code to create a ps file Bharath Vikraman CLIST & REXX 4 Mon Aug 07, 2017 10:30 am
No new posts I want to retire TRX and use only Rex... Abhinav Sharma CLIST & REXX 6 Sat Jul 29, 2017 2:53 am
No new posts Split file based on comparsion to 2 f... Div Grad DFSORT/ICETOOL 3 Thu Jul 27, 2017 9:16 pm
No new posts UNIT=AFF for Easytrieve code gandikk JCL & VSAM 7 Wed Jul 12, 2017 11:42 pm


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