How do we get run time of robo jobs programatically ?


I have one requriment to built. We have few robo jobs which are scheduled through out the day. We have approx run time for all jobs. What I need is if any of these job takes more then that estimated time then we will generate a report which we can motitor everyday.

Problem with this is how can I get the the run time for robot job programatically ?

Thanks for help in advance....

Prashant Patel
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.


There is a variety of ways. Two possibilities:

1. Start up job accounting -- the accounting journal entries for the job should give you what you need. Job starting date/time is in the entry; job ending date/time is the date/time of the journal entry itself.

2. Process QHST* files to interpret entries for the dates involved and for the jobs you want. The message IDs are CPF1124 for start and CPF1164 for end. These can be tricky files to process correctly.

Are you using Help Systems Robot/Scheduler?
Job monitors allow you to monitor your job schedule for specific events,
such as jobs that run too long, complete too quickly, or start later than
their scheduled run time. You can specify the criteria for each monitored
job at setup time. You also specify what Robot/SCHEDULE should do if
it identifies a job monitor event. Robot/SCHEDULE can end a job or
notify you by sending a message to the job’s message queue; sending a
text, e-mail, or pager message via Robot/ALERT; or sending a status to
the Robot/NETWORK Status Center.
When a monitored job reaches one or more of the criteria defined on the
Job Monitors panel, Robot/SCHEDULE takes the specified action and
enters a record in the job monitor event log.
The Job Monitor Events Report lists all monitored events that have occurred
on the system. You can print the report from the Job History Report
Selection panel; starting at the Robot/Scheduler Main Menu, take option 3) Control Menu, then 6) Job History Reports.
If you need to query the Robot database directly, please post back!
inform_prashantAuthor Commented:

Thaks for replying....How can we start job accounting and the how can we read that in program.(Sorry if this is a very basic question !!)


Thanks to you for your reply...I saw 'Job histroy Report' and I think 'Good Morning Report' will be very useful for me becuase I was looking for a report which will advice me about jobs which took long and varied from its expected time. But I have 3 questions regarding that.
1) When we give 'Runtime Devation (%)' how it calculates the avarager runt time to find out the deviation.
2) What is Forecast name and how can we use that ?
3) Once we schedule this job on ROBOT then how can we manage to send that spoll file to e-mail few of the guys ? Can we copy that file into stram file and then send that file via SNDDST ?

Thanks to both of you again for your reply...

Prashant Patel
Cloud Class® Course: C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

Hi Prashant

The Good Morning Report runs several reports at the same time, including a job summary. Reviewing and archiving the summary report is often required by SARBOX.

1) The documentation says that it averages the runtimes and reports on those outside of the runtime deviation percentage.

2) You can create a forecast of how the scheduler predicts the jobs will run. The report will show the variances between the actual run times and the forecast.

3) You can schedule the Good Morning Report using a program like the sample source below.

DCL &TODAY      *CHAR     6
DCL &TODAYN     *DEC   (6 0)
DCL &YESDAY     *CHAR     6
DCL &YESDAYN    *DEC   (6 0)
DCL &INCDAT     *DEC   (6 0)
DCL &DESC       *CHAR    44
DCL &REPORT      *CHAR    12   /* NAME OF REPORT                     */
             MONMSG CPF2100
             /*                                                     */
             /* CALCULATE YESTERDAY'S DATE                          */
             /*                                                     */
             RTVJOBA    DATE(&TODAY)
             CHGVAR  &TODAYN  &TODAY
             CHGVAR  &INCDAT  1
             CHGVAR  &YESDAY  &YESDAYN
         /*** if you need to re-run the report, use this ***/
        /*** CHGVAR  &YESDAY  '071004'    /**RERUN****/
             SNDPGMMSG &YESDAY
             /*                                                     */
             /* CREATE GOOD MORNING REPORTS                         */
             /*                                                     */
             OVRPRTF RB9401P4 HOLD(*YES)
             OVRPRTF RB9401P3 HOLD(*YES)
             OVRPRTF RB9401P2 HOLD(*YES)
             OVRPRTF    FILE(RB9401P1) HOLD(*YES)
             /*                                                     */
             /* EMAIL REPORT                                        */
             /*                                                     */
             CHGVAR &DESC  'Good morning report WITH ABENDS'
             CRTPF      FILE(QTEMP/GOODM) RCDLEN(132) SIZE(500000)
             MONMSG (CPF7300)
             CPYSPLF    FILE(RB9401P1 ) TOFILE(QTEMP/GOODM  ) +
                          SPLNBR(*LAST) MBROPT(*REPLACE)
             CPYSPLF    FILE(RB9401P2) TOFILE(QTEMP/GOODM) +
                          SPLNBR(*LAST) MBROPT(*ADD)
             MONMSG (CPF3300) EXEC(DO) /* NO ABENDS FOUND   */
                CHGVAR &DESC  'Good morning report'
             CHGVAR &REPORT  VALUE('GM' || &TODAY || '.TXT')
                          TODOC(&REPORT  ) REPLACE(*YES)
             <insert your own FTP here>
             /* Email the report */
             SNDDST     TYPE(*DOC) +
                          TOINTNET(( +
                          ( DSTD(&DESC) +
                          MSG(&DESC) DOC(&REPORT) FLR(OPS) +

If you have any questions, please post back!

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial

Barry's familiarity with ROBOT seems like a strong possibility for you.

For your later questions...

First, verify that job accounting is not already active. The existence of the system accounting journal plus a value that includes *JOB in system value QACGLVL should tell you if accounting is active. The accounting journal is named QSYS/QACGJRN.

You can process the journal by using either DSPJRN to an *OUTFILE and reading the file or RCVJRNE to receive entries directly into a variable. (There are also Journal APIs for both OPM and ILE, but it might be easier to learn what the commands do first.) If you use DSPJRN, you should first create the *OUTFILE by duplicating the model file from QSYS into a work library. The file is QSYS/QAJBACG for basic entries of *TYPE1 and QSYS/QAJBACG4 for *TYPE4. Use CRTDUPOBJ to create your work file. This can be done interactively to get a feel for the results. Do _NOT_ use the file in QSYS to display journal entries into.

Minor note on SNDDST... You can send a streamfile with SNDDST, but I'm not sure if it's possible to send a streamfile that isn't in the /QDLS file system. That might be an issue if you're creating this programming for a customer. Using the SMTP functions might be a better choice. The QtmmSendMail API is one way to get into SMTP mail functions.

inform_prashantAuthor Commented:
Hi Barry,

I think I have got everything ..Thanks a lot...I will also keep in mind Tom's note.

Thanks again to both of your for your help....I will keep this question for any help till I designe the prototype of this. Just for my information Barry, you also said that if you I want to query ROBOT databse directly then post back....How can we do that ????

Thanks again...

Prashant Patel
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Operating Systems

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.