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 Sort numeric fields with trailing spaces sancraig16 SYNCSORT 7 Tue Apr 03, 2018 1:21 am
No new posts Find & Replace string in CA-SORT mrgnndhmk CA Products 1 Fri Mar 30, 2018 12:58 am
No new posts SORT 3 files,extract specific fields ... Kiransr DFSORT/ICETOOL 13 Fri Mar 23, 2018 10:54 am
No new posts How syntax check at Bind time is diff... Poha Eater DB2 5 Wed Mar 21, 2018 9:16 pm
No new posts How to Generate JCL using Sort naveen katkuri DFSORT/ICETOOL 7 Tue Mar 13, 2018 3:50 pm

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