INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

calculate elapse time in PL/1

calculate elapse time in PL/1

(OP)
Hi

has any one a subroutine that calculate the elapse time in PL/I?

Thanks

RE: calculate elapse time in PL/1

(OP)
OK, I done by my self:

   DCL  sta_datime  CHAR(17)     INIT(DATETIME()); /* start date time*/  
...
CALL PRT@ELAP
...
PRT@ELAP: PROC;     
   DCL  end_datime  CHAR(17)     INIT(DATETIME()); /* Date and Time   */
                                                                       
     dcl 1 sta_time,                                                   
           2 sta_std     CHAR(02)  INIT(SUBSTR(sta_datime,9,2)),       
           2 tren1       CHAR(01)  INIT(':'),                          
           2 sta_min     CHAR(02)  INIT(SUBSTR(sta_datime,11,2)),      
           2 tren2       CHAR(01)  INIT(':'),                          
           2 sta_sec     CHAR(02)  INIT(SUBSTR(sta_datime,13,2)),      
           2 tren3       CHAR(01)  INIT('.'),                          
           2 sta_sth     CHAR(02)  INIT(SUBSTR(sta_datime,15,2));      
                                                                       
     dcl 1 end_time,                                                   
           2 end_std     CHAR(02)  INIT(SUBSTR(end_datime,9,2)),       
           2 tren1       CHAR(01)  INIT(':'),                          
           2 end_min     CHAR(02)  INIT(SUBSTR(end_datime,11,2)),      
           2 tren2       CHAR(01)  INIT(':'),                          
           2 end_sec     CHAR(02)  INIT(SUBSTR(end_datime,13,2)),      
           2 tren3       CHAR(01)  INIT('.'),                          
           2 end_sth     CHAR(02)  INIT(SUBSTR(end_datime,15,2));      
                                                                       
     DCL  sta_time_s  DEC FIXED(15,2);            /* Start time sec  */
     DCL  end_time_s  DEC FIXED(15,2);            /* End time sec    */
     DCL  elapsed_t   PIC'99999V.99';             /* Print form      */
                                                                       
     sta_time_s = 3600 * sta_std  +               /* Calc. Std in Sec*/
                    60 * sta_min  +               /*+Calc. Min in Sec*/
                         sta_sec !! '.' !! sta_sth; /*+ sec and th   */
                                                                       
     end_time_s = 3600 * end_std  +               /* Calc. Std in Sec*/
                    60 * end_min  +               /*+Calc. Min in Sec*/
                         end_sec !! '.' !! end_sth; /*+ sec and th   */
                                                                       
     elapsed_t = end_time_s - sta_time_s;         /* Calc. elapsed t */
                                                                       
                                                                       
     PUT SKIP    FILE(DDPRINT) EDIT('  ',(114)'_',' ') (A);            
     PUT SKIP    FILE(DDPRINT) EDIT(' |',(114)' ','|') (A);            
                                                                       
     PUT SKIP    FILE(DDPRINT) EDIT                                    
      (' | OS2900  End of Print-Output:  RC=',PRT_RC,                  
       '   Start=',sta_time,'   End=',end_time,                        
       '   Elapsed=',elapsed_t,' (sssss.thh)        |') (A);           
                                                                       
                                                                       
     PUT SKIP    FILE(DDPRINT) EDIT(' |',(114)'_','|') (A);  
END PRT@ELAP;            
...
...

This Code works with PL/1 for MVS & VM and so with Ent. PL/1 V3.5

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close