ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Check the completion of a job

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Check the completion of a job

    Hello All,
    I need help of all experts here, I have a Job that submits at a particular time. Say Job A submits daily at 6:00:00 EST. This job A internally submits many other jobs. So i dont have the job number of the job. I just have the Job name and the User through which the job submits. Now i need to check weather this job completed or not. The worse part is i cant change the existing code.
    So how do i get to know the job status of a Job for that particular day with the Job Name and the user which submits this Job.

  • #2
    Re: Check the completion of a job

    I tried finding the ways, Some one advised me to use QWCRJBST API but this API requires Job number as a parameter. I am not able to get the right way how this could be done.

    Comment


    • #3
      Re: Check the completion of a job

      The QUSLJOB API should let you do this. It doesn't require a job number, and you can supply a job and user name. Job number is described this way:

      Job number CHAR(6). A specific job number or the following special value:

      *ALL Jobs with the specified job name and user name, regardless of the job number. The rest of the job name parameter must be specified.

      Cheers,

      Emmanuel

      Comment


      • #4
        Re: Check the completion of a job

        Originally posted by Nilesh3110
        The worse part is i cant change the existing code.
        Why not?

        But even if you can't change any code in the program that is currently submitted by the job scheduler, perhaps you can change the job scheduler entry. For example, the job scheduler might submit a CALL PGMA command and you are not allowed to change PGMA. But you might change the job scheduler entry to CALL PGMB instead.

        Code PGMB to log a message that contains the fully qualified job name and then call PGMA. It's a simple CL wrapper that gives you the job name, runs the same program that runs now and doesn't change existing code.

        But you might also simply change the job log entry so that it sends you a message when the submitted job completes. Use CHGJOBSCDE MSGQ() and specify an appropriate message queue for the job. You might create a message queue just for this purpose. When the job is submitted, a CPC1236 will be sent to the queue; and when the job finishes, a CPF1241 will be sent.

        The system already does what you ask for. All that's needed is to read the messages.
        Tom

        There are only two hard things in Computer Science: cache invalidation, naming things and off-by-one errors.

        Why is it that all of the instruments seeking intelligent life in the universe are pointed away from Earth?

        Comment


        • #5
          Re: Check the completion of a job

          Sorry for the late reply as i was on a Vacation, I am able to able to get the job completion in the OUTQ using the API QUSLJOB API. But the problem lies that when i am checking for the OUTQ. I am getting the outq of the jobs for all the dates. I need to know just for today. Is there a way to create the user space or any other way to just take the OUTQ for today(Syatem Date). I tried checking the ways but was didn't find any. Please help.

          Comment


          • #6
            Re: Check the completion of a job

            If you want to use QUSLJOB to get a list of all jobs that match the job name, you will need to loop through the list to get each of the fully qualified job names and pass each name to the Retrieve Job Information (QUSRJOBI) API (maybe using JOBI0400 Format).

            That API can return details such as the job start date and time. When you find a match on the date that you want, you might assume that the fully qualified job name is the one that you want.
            Tom

            There are only two hard things in Computer Science: cache invalidation, naming things and off-by-one errors.

            Why is it that all of the instruments seeking intelligent life in the universe are pointed away from Earth?

            Comment


            • #7
              Re: Check the completion of a job

              Originally posted by tomliotta View Post
              ...you will need to loop through the list to get each of the fully qualified job names and pass each name to the Retrieve Job Information (QUSRJOBI) API (maybe using JOBI0400 Format).
              I believe that output queue, date and time job started and ended, and lots more is available directly from the QUSLJOB API - not sure why you would need to use the second API. What am I missing?

              Cheers,

              Emmanuel

              Comment


              • #8
                Re: Check the completion of a job

                Originally posted by EmmanuelW1 View Post
                I believe that output queue, date and time job started and ended, and lots more is available directly from the QUSLJOB API - not sure why you would need to use the second API. What am I missing?
                True enough. You're not missing anything, but it seems plausible that the OP might have more difficulty with processing the optional form of QUSLJOB.

                The system already provides a method of determining submitted job completion, but the OP is wanting to create something different for some unstated reason. It's usually easier to grasp a call to the second API than to work through the details of the 'requested keys' and to process the returned values. But maybe not.
                Tom

                There are only two hard things in Computer Science: cache invalidation, naming things and off-by-one errors.

                Why is it that all of the instruments seeking intelligent life in the universe are pointed away from Earth?

                Comment


                • #9
                  Hi,

                  What will happen if submit multiple jobs with same name. Which Job it will consider?

                  Comment


                  • #10
                    Each job gets allocated job number which uniquely identifies it-
                    Regards

                    Kit
                    http://www.ecofitonline.com
                    DeskfIT - ChangefIT - XrefIT
                    ___________________________________
                    There are only 3 kinds of people -
                    Those that can count and those that can't.

                    Comment


                    • #11
                      Back in the deep dark days before APIs and other such tools were available and I needed to know if a job ran ok, I'd create a dummy file.

                      First step in the cl, create an empty file, no DDS, no data, no nothing, just give it a unique name. Last step in cl, is delete this file.
                      If the file exists, the job did not complete.

                      Comment

                      Working...
                      X