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
 
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. Incrementing current time field by 30... arunsoods DFSORT/ICETOOL 11 Thu Oct 26, 2017 3:22 pm
No new posts Subtract the ZD fields to provide neg... Balaryan DFSORT/ICETOOL 4 Wed Oct 11, 2017 10:51 pm
No new posts sort records based on length exceeds ... maxsubrat DFSORT/ICETOOL 7 Wed Oct 04, 2017 4:48 pm
No new posts Addition of two records on 2 fields amar143 SYNCSORT 8 Tue Oct 03, 2017 11:14 am
No new posts Partial color change of a field in CI... waseem0424 CICS 5 Fri Sep 29, 2017 7:56 pm

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