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

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 Validate date and numeric fields and ... Rick Silvers DFSORT/ICETOOL 6 Thu May 11, 2017 6:51 pm
No new posts Adding big TEXT lines to each record ... bshkris SYNCSORT 4 Sat May 06, 2017 1:40 am
This topic is locked: you cannot edit posts or make replies. Merge two files and update Trailer re... Yashashri JCL & VSAM 1 Thu May 04, 2017 12:54 pm
No new posts Sum Fields ballaswaroop DFSORT/ICETOOL 4 Tue May 02, 2017 11:07 am
No new posts Sort Large record length cmsmoon DFSORT/ICETOOL 14 Tue Apr 11, 2017 5:49 pm


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