Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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 Sum the fields in particular format f... sharana64 DFSORT/ICETOOL 9 Fri Jan 05, 2018 1:11 am
No new posts SORT BUT RETAIN HIGHEST VALUE ON NON-... leondan22 DFSORT/ICETOOL 2 Thu Dec 14, 2017 8:13 pm
No new posts Merging 2 records at multiple rows wi... Bijesh DFSORT/ICETOOL 2 Wed Dec 06, 2017 1:50 am
No new posts Extract record for change in combinat... Trinadh DFSORT/ICETOOL 6 Thu Nov 23, 2017 3:32 pm
No new posts Comparision with current time arunsoods DFSORT/ICETOOL 5 Thu Nov 09, 2017 10:37 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us