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 All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Format data from multiple records usi... SYNCSORT 4
No new posts Alternative of JoinKeys in SORT DFSORT/ICETOOL 2
No new posts Sort SMF records? SYNCSORT 6
No new posts To Sort detail records in a file with... SYNCSORT 5
No new posts PL/1 SEND CICS MAP first time, attrib... CICS 6
Search our Forums:


Back to Top