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
 

 

Summing up time format fields in Sort

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

New User


Joined: 24 Jun 2010
Posts: 2
Location: Chennai

PostPosted: Thu Jun 24, 2010 1:02 pm    Post subject: Summing up time format fields in Sort
Reply with quote

I have time values with : in between Hrs:Mins:sec..I want to Sum them up for reporting purpose. How to establish in Icetool / Sort.
Back to top
View user's profile Send private message

sqlcode1

Active Member


Joined: 08 Apr 2010
Posts: 578
Location: USA

PostPosted: Thu Jun 24, 2010 5:34 pm    Post subject:
Reply with quote

Please show us input and expected output with field positions and lrecl for the files.

Thanks,
Back to top
View user's profile Send private message
hsivaramakrishnan

New User


Joined: 24 Jun 2010
Posts: 2
Location: Chennai

PostPosted: Thu Jun 24, 2010 5:40 pm    Post subject: Summing up time format fields in Sort
Reply with quote

Time in 15th position in file FB...in Format Hrs:Mins:Secs, in output i want to sum up the time available in all the records and report in 20th position in the output FB.
Back to top
View user's profile Send private message
gabriel.ryoga

New User


Joined: 07 Jun 2007
Posts: 31
Location: Spain

PostPosted: Thu Jun 24, 2010 6:52 pm    Post subject:
Reply with quote

It's a bit hard to give you an accurate solution, you should try to be a little bit more descriptive... but maybe this can solve your problem:

Code:
 
//JS010    EXEC SORT,COND=(4,LT)                                     
//SORTIN   DD  *                                                     
              01:02:30                                               
              02:03:20                                               
//SORTOUT  DD  SYSOUT=*                                             
//SYSIN    DD  *                                                     
   INREC FIELDS=(1,80,C'1',(15,2,ZD,MUL,+3600),ADD,(18,2,ZD,MUL,+60),
                 ADD,21,2,ZD,TO=ZD,LENGTH=12)                       
   SORT FIELDS=(81,1,CH,A)                                           
   SUM FIELDS=(82,12,ZD)                                             
   OUTREC FIELDS=(19X,82,12,ZD,DIV,+3600,EDIT=('TT'),C':',           
                  82,12,ZD,DIV,+60,SUB,                             
                 (82,12,ZD,DIV,+3600),MUL,+60,EDIT=('TT'),C':',     
                  82,12,ZD,SUB,                                     
                 (82,12,ZD,DIV,+3600),MUL,+3600,SUB,                 
                 (82,12,ZD,DIV,+60),MUL,+60,EDIT=('TT'))             


This will give you the answer in HH:MM:SS, on the 20th position of the output.

I've assumed that the sum of the times is not going to be greater than 99 hours.
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 change 'K' or 'M' use Sort vice_versa DFSORT/ICETOOL 5 Thu May 18, 2017 7:11 am
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
No new posts DSNACCOX (can it be run on 1 db/ts, t... SRICOBSAS DB2 3 Sat May 06, 2017 12:59 am
No new posts Sum Fields ballaswaroop DFSORT/ICETOOL 4 Tue May 02, 2017 11:07 am


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