Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Display the time my job ran for.

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
anjani shanker

New User


Joined: 26 Jan 2007
Posts: 37
Location: USA

PostPosted: Tue Apr 01, 2008 8:45 pm    Post subject: Display the time my job ran for.
Reply with quote

How can i display the time for which my program(Simple cobol codes including the SQLs) ran. Means the time taken between I submitted my job and the time I got the return code.

Please provide me with the suggestions.
Back to top
View user's profile Send private message

dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Tue Apr 01, 2008 9:30 pm    Post subject:
Reply with quote

Hello,

Display the time when your program enters the PROCEDURE DIVISION and again display the time when you "get the return code".
Back to top
View user's profile Send private message
Anuj Dhawan

Senior Member


Joined: 22 Apr 2006
Posts: 6258
Location: Mumbai, India

PostPosted: Tue Apr 01, 2008 10:01 pm    Post subject:
Reply with quote

or look into JESMSGLG of a JOB. There can be alternate way if you've JHS installed at your shop.
Back to top
View user's profile Send private message
anjani shanker

New User


Joined: 26 Jan 2007
Posts: 37
Location: USA

PostPosted: Tue Apr 01, 2008 10:08 pm    Post subject:
Reply with quote

Hello Anuj & DS,

Anuj,
Regarding the Jesmsglg, i can only see the start and end time....I need this time to be displayed in my program.

DS,
Do you have any idea regarding how can i display the time when the pgm enters P.D. and the time it finds the stop run command.
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Tue Apr 01, 2008 10:24 pm    Post subject:
Reply with quote

You would have to display the end time before the stop run. See Dick's message above.
Back to top
View user's profile Send private message
agkshirsagar

Active Member


Joined: 27 Feb 2007
Posts: 685
Location: Earth

PostPosted: Tue Apr 01, 2008 10:32 pm    Post subject:
Reply with quote

use CURRENT-DATE intrinsic function to get current time.
OR
use ACCEPT TIME-VAR from TIME
OR
Use CURRENT_TIME special register to get time from DB2

.. then display the value you got in working storage variable.
See the manual if you need more help in using above suggestions.

As already suggested by Craq and Dick ( Good rhyming, isn't it? icon_smile.gif ) you have to do it twice, after PROCEDURE DIVISION and before the STOP RUN.
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Tue Apr 01, 2008 10:36 pm    Post subject:
Reply with quote

Hello,

Do you want to know when the "return code" is returned or when the program is going to terminate? There could be some amount of time elapse between the return code and the termination. . .

Code:
ACCEPT MY-TIME FROM TIME.
DISPLAY MY-TIME.
will do what you want.
Back to top
View user's profile Send private message
anjani shanker

New User


Joined: 26 Jan 2007
Posts: 37
Location: USA

PostPosted: Tue Apr 01, 2008 10:47 pm    Post subject:
Reply with quote

Thanks everyone for putting inputs...

I have opted displaying the time twice as said by DS just after P.D. and just before Stop run.

Also wanted to check if there is any intrinsic function available for my requirement as we have functions like when-compiled. I guess there are no such function available.Am I right???
Back to top
View user's profile Send private message
anjani shanker

New User


Joined: 26 Jan 2007
Posts: 37
Location: USA

PostPosted: Tue Apr 01, 2008 10:51 pm    Post subject:
Reply with quote

D.S.

Actually i wanted to display for how much my program run. I have better explanation for this.

I wanted to display the difference of

STARTED - TIME=08.34.21
ENDED - TIME=08.34.22 of

JESMSGLG
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Tue Apr 01, 2008 11:51 pm    Post subject:
Reply with quote

Hello,

Without getting too fancy, you could convert the start and end times to seconds, subtract the "start second" from the "end second", and convert the answer back to hours, minutes, and seconds.

One simple check i'd include would be to ensure that the end time was later than the start time.

How elegant you make the solution depends on if the job is of fairly short duration and if it might run over midnight. If the job(s) run over midnight, add 86400 (if i did it right, that is the number of seconds in a day) to the "end second" before subtracting.
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Tue Apr 01, 2008 11:55 pm    Post subject:
Reply with quote

Convert hours to seconds and minutes to seconds then subtract the begin from the end. If the difference is negative add 86400 to results. Divide the results by 60 to get minutes with the remainder as seconds, divide the minutes by 60 to get hours with the remainder as minutes.

If your job never runs more than 24 hours this will work.

Code:
COMPUTE START-TIME = (START-HOURS * 3600) + (START-MINUTES * 60) + START-SECONDS.
COMPUTE END-TIME = (END-HOURS * 3600) + (END-MINUTES * 60) + END-SECONDS.
SUBTRACT START-TIME FROM END-TIME GIVING RUN-TIME.
IF RUN-TIME < 0
    ADD 86400 TO RUN-TIME
END-IF.
DIVIDE RUN-TIME BY 60 GIVING RUN-TIME REMAINDER RUN-SECONDS.
DIVIDE RUN-TIME BY 60 GIVING RUN-HOURS REMAINDER RUN-MINUTES.
Back to top
View user's profile Send private message
anjani shanker

New User


Joined: 26 Jan 2007
Posts: 37
Location: USA

PostPosted: Wed Apr 02, 2008 2:47 am    Post subject:
Reply with quote

Thanks Crag.....

It worked icon_smile.gif
Back to top
View user's profile Send private message
Anuj Dhawan

Senior Member


Joined: 22 Apr 2006
Posts: 6258
Location: Mumbai, India

PostPosted: Wed Apr 02, 2008 4:55 am    Post subject:
Reply with quote

Hi Craiq,

Pehaps I was never in a need to implement the above, well, after reading the thread I'm still not sure about how to find time for this
Quote:
the time I got the return code

Can you please guide me what will be there in END-TIME, today i'm thinking too hard I guess..
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Wed Apr 02, 2008 6:07 am    Post subject:
Reply with quote

Hi Anuj,

Quote:
what will be there in END-TIME,
END-TIME will have whatever time is in the system clock when the code gets it from the system variable.

Placement in the code would be entirely up to the coder. It could be when the return-code is detected after an sql statement or it could be at end-of-job or anywhere else that there was a need to see how much time had elapsed between 2 places in the code.
Back to top
View user's profile Send private message
Anuj Dhawan

Senior Member


Joined: 22 Apr 2006
Posts: 6258
Location: Mumbai, India

PostPosted: Wed Apr 02, 2008 7:28 am    Post subject:
Reply with quote

Hi Dick,

dick scherrer wrote:
whatever time is in the system clock when the code gets it from the system variable.
Did you want to say there will be a statement like this
Code:
ACCEPT END-TIME FROM TIME.
in the program just before GOBACK ? If yes, I'm just curious to know, what will be the use of such an information..
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Wed Apr 02, 2008 8:23 am    Post subject:
Reply with quote

Hi Anuj,

Quote:
what will be the use of such an information..
If one was to "accept the time" at the "start" of a process and at the "end" of a process, or a subroutine, or from one point until another, one could calculate the duration.

It is fairly common to want to know how long "something" takes. In this case the duration is clock tme rather than calendar time (i.e. days).

Look above at the previous replies. Both a description and the code to do this have been posted.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Wed Apr 02, 2008 11:08 am    Post subject:
Reply with quote

This topic falls under 'useless information'. requirements of this silly nature are usually demanded by someone who knows nothing about computers.

all you are calculating is elapsed wall clock time.

if on monday I run this program and nothing else is running in the box, the elapsed time will be x.

if on tuesday I run this program and it is end of month, end of quarter, the box would probably be busy and the program would get time slices shared with 100 jobs instead of just 1. thus the elapsed time will be greater.

Depending upon services called by the job, the elapsed time will be even longer if the demand upon services (more jobs in the system) is greater; especially db2.
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Wed Apr 02, 2008 8:11 pm    Post subject:
Reply with quote

Hello,

Quote:
This topic falls under 'useless information'.
'Fraid i must not quite agree. . .

This can be a very easy way to get some numbers to isolate sections of problem code.

I've been invited to be part of several very large data conversion exercises (usually after it was discovered that there was not enough time for the comversion process to run in the cutover time-frame). To get some system to the "new replacement system", most of the existing data had to be converted. Some of these conversion programs would run for multiple days wall-time due to the way the they were implemented.

A common "offender" was the desire to use the "new" data validation routines to validate the old data to be converted. These routines were called-subroutines that were meant to support the online transactons that input new user data. In the "real" environment, they ran sub-second combined, but when there were from millions to hundreds of millions of validations, the one-at-time method came up very lacking.

By showing elapsed time at various places in the code the conversion teams were able to focus on which improvements gave the "biggest bang" for the time invested to get the performance to acceptable.

If several benchmarks were run with different machine loads, the numbers didn't mean much for posterity, but they did help point where to start with the process improvements.

FWIW. . .
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 -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
This topic is locked: you cannot edit posts or make replies. Get a job submitted itself every time... arunsoods JCL & VSAM 3 Tue Nov 22, 2016 4:05 pm
No new posts Check System time(Minute) Using TIME1... balaji81_k DFSORT/ICETOOL 5 Fri Nov 11, 2016 10:53 am
This topic is locked: you cannot edit posts or make replies. Get correct date and time when curren... balaji81_k DB2 24 Fri Oct 14, 2016 10:40 pm
No new posts How to display value of an exit param... lind sh CICS 2 Sun Oct 09, 2016 12:28 pm
This topic is locked: you cannot edit posts or make replies. DSList (3.4) cannot display Chinese c... jacobdng TSO/ISPF 4 Wed Oct 05, 2016 2:51 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us