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 SYNCSORT SEQNUM and FI fields. nartcr SYNCSORT 5 Sat Jan 21, 2017 4:02 am
No new posts How to Capture the Max return code of... anilkumar922 All Other Mainframe Topics 0 Thu Jan 12, 2017 12:02 pm
No new posts INVALID FIELD OR CONSTANT IN SORTOF ?? Ron Klop DFSORT/ICETOOL 8 Wed Jan 11, 2017 3:44 pm
This topic is locked: you cannot edit posts or make replies. Calling REXX code from ISPF panel sanchita dey TSO/ISPF 4 Mon Jan 02, 2017 5:13 pm
No new posts Syncsort Help to group fields sudhakarraju SYNCSORT 6 Thu Dec 29, 2016 1:38 am


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