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
 
Keeping fields on a summarization record

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

New User


Joined: 27 Aug 2008
Posts: 14
Location: USA

PostPosted: Mon Jul 09, 2012 6:37 pm    Post subject: Keeping fields on a summarization record
Reply with quote

I have a file that I am summing 2 fields and need to keep specific data from field 3, when field 3 is equal to "2". The sum always happens based on key, but if there is 1 record on that key with field3="2" I need to keep the "2" in field3. The only way I can think of is to sum file into 1 file, save all "2" into another file then splice the 2 back together. Is there another way?

Currently, I have code:
Code:
  SORT FIELDS=(01,04,CH,A,               
               05,04,CH,A,               
               09,01,CH,A,               
               10,01,CH,A,               
               11,09,CH,A,               
               20,05,CH,A,               
               25,10,CH,A)               
 OUTREC FIELDS=(1,44,                     
               52,52,                     
               +0,TO=PD,LENGTH=9,         
               +0,TO=PD,LENGTH=9,         
               104,9,                     
               113,9,                     
               122,4,                     
               C'C',                     
               175X)                     
    SUM FIELDS=(104,9,PD,                 
                113,9,PD)                 


Input: (the wanted field is the 2 in the "2C" area)
Code:

00462012RC16H45206 436S92012-02-212012-02-21JBSTCV ..LAS VEGAS SANDS CORP                              .................ýN 1C..
00462012RC16H45206 436S92012-02-212012-02-21JBSTCV ..LAS VEGAS SANDS CORP                              ......°........ìã.N 2C..
00462012RC16H45206 436S92012-02-212012-02-21JBSTCV ..LAS VEGAS SANDS CORP                              ..............ì&`)N 2C..


Output:
Code:
00462012RC16H45206 436S92012-02-212012-02-21..LAS VEGAS SANDS CORP                              ................................Ñ.&(N 1CC


Wanted Output:
Code:
00462012RC16H45206 436S92012-02-212012-02-21..LAS VEGAS SANDS CORP                              ................................Ñ.&(N 2CC
Back to top
View user's profile Send private message

Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7314

PostPosted: Mon Jul 09, 2012 8:45 pm    Post subject:
Reply with quote

Your problem is that the first record into the SUM is used as the base for the summing. If you have EQUALS, you will always get the first record on the input file as the base, without EQUALS you will get whatever record happens along first.

You want the last record, it looks like.

What is the order of the input file? Are you only doing the SORT to allow the SUM?
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 How to select record x+7 or x+2 based... JoAnn Kulcyk SYNCSORT 0 Tue Jan 16, 2018 10:49 pm
No new posts Sum the fields in particular format f... sharana64 DFSORT/ICETOOL 9 Fri Jan 05, 2018 1:11 am
No new posts SORT BUT RETAIN HIGHEST VALUE ON NON-... leondan22 DFSORT/ICETOOL 2 Thu Dec 14, 2017 8:13 pm
No new posts query to fetch record which has only ... maxsubrat DB2 12 Mon Dec 11, 2017 5:03 pm
No new posts Merging 2 records at multiple rows wi... Bijesh DFSORT/ICETOOL 2 Wed Dec 06, 2017 1:50 am

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