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
 

 

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: 7254

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 SYNCSORT SEQNUM and FI fields. nartcr SYNCSORT 5 Sat Jan 21, 2017 4:02 am
No new posts Syncsort Help to group fields sudhakarraju SYNCSORT 6 Thu Dec 29, 2016 1:38 am
No new posts How to update a portion of text in a ... Bill Woodger DFSORT/ICETOOL 25 Wed Nov 09, 2016 9:41 pm
No new posts Access SQLCA fields inside a stored p... gangapd DB2 4 Thu Oct 27, 2016 10:20 am
No new posts sort with previous record anatol DFSORT/ICETOOL 9 Thu Oct 06, 2016 2:36 am


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