IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Summing up time format fields in Sort


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
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
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: 577
Location: USA

PostPosted: Thu Jun 24, 2010 5:34 pm
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
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Populate last day of the Month in MMD... SYNCSORT 2
No new posts Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
No new posts JCL sort card - get first day and las... JCL & VSAM 9
No new posts To get the the current time DFSORT/ICETOOL 13
Search our Forums:

Back to Top