Unconfigured Ad Widget

Collapse

Announcement

Collapse
No announcement yet.

TESTING FOR A SPECIFIC ACTIVE JOB

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

  • TESTING FOR A SPECIFIC ACTIVE JOB

    cjh2os wrote: > There is an s/36 ocl command that is used to test for specific jobs > being active, example: // IF ACTIVE-'ARUPDT' RETURN How is this done > using CL? I believe the concensus is that there isn't one best way. Here's an earlier discussion on this subject: http://mcpressonline.com/mc?14@157.E...SearchMark=1#1 Bill

  • #2
    TESTING FOR A SPECIFIC ACTIVE JOB

    Two ways that I've seen mentioned as solutions to this: 1. Create a data area, job A puts shared lock on it, job B testing to see if Job A is active attempts to put exclusive lock on it. Test for success. 2. Thru code the locks the *PGM object. A third way, if you have TAATOOLS: CHKACTPGM (help text indicates it functions like 2nd method above). The IF ACTIVE sure was a real simple method that I used a lot.
    Code

    Comment


    • #3
      TESTING FOR A SPECIFIC ACTIVE JOB

      Bill Thanks for the info. Carl

      Comment


      • #4
        TESTING FOR A SPECIFIC ACTIVE JOB

        Russ Thanks for the quick reply. Carl

        Comment


        • #5
          TESTING FOR A SPECIFIC ACTIVE JOB

          Russ, Are you *SURE* locking the *PGM object works? Do an ALCOBJ and read the help text. Chris
          Code

          Comment


          • #6
            TESTING FOR A SPECIFIC ACTIVE JOB

            Chris: No I'm not sure as I don't recall ever using this code - only made note of it from past searches for the same info. Since I didn't test it, you may be right that ALCOBJ does not prevent other users from running the code. I should have put a caveat on my response. As far as the TAATOOL CHKACTPGM, the some help text reads as follows.
            Code

            Comment


            • #7
              TESTING FOR A SPECIFIC ACTIVE JOB

              I would recommend using the Job API's. They will return the status of the job (if you need it) as well as other information. Consult the IBM manuals for more specific values. Here is the program that I use. You can make the call as specific or as generic as you need it. I hope it helps.
              Code

              Comment


              • #8
                TESTING FOR A SPECIFIC ACTIVE JOB

                I believe there is some confusion as to what is needed. On the System/36, the IF ACTIVE tested for an active procedure, not an active job in the sense of a job on the i5. The analogy on the i5 is to an active program. Unfortunately, if I am executing a program, I have no lock on the program. Another job can successfully execute an ALCOBJ command with *EXCL of the program. If I have an exclusive lock on a program, another job can still execute that program. I believe that the only suggestion that has been expressed here that works is the allocation of the data area. Of course, that means you need to put the code to allocate the data area into each program that you want to test as active (and you want to make sure it deallocates the object even if the program (but not the job) aborts). No doubt, the System/36 presented an easier interface.

                Comment


                • #9
                  TESTING FOR A SPECIFIC ACTIVE JOB

                  Allocate the program with a shared read lock prior to calling the program, then remove the lock when the program completes processing. Exclusive locks are not necessary, when you take the next step and use the “List Object Locks” QWCLOBJL API rather than the simple ALCOBJ command, waiting for a timeout. The API runs much faster then waiting for a time out so performance is not an issue. A simple check for any locks is enough to know if a program is in use. Exclusive locks is a straight path to “abends” and prevents objects from being backed up and should always be avoided. Since the reference to TAATOOL was already made as a solution, I offer the product “SMI SuperVisor” as an additional third party product that offers easy to use commands that can be used to check to see if objects are in use, without the need to use Exclusive Allocations to monitor for references to active usage to objects. Note: Any allocation created with ALCOBJ remains in affect until a DLCOBJ command is issued, or until the time the job ends. Using the ALCOBJ command is cumulative. Issue ALCOBJ 5 times requires you to issue DLCOBJ 5 times.

                  Comment


                  • #10
                    TESTING FOR A SPECIFIC ACTIVE JOB

                    I believe there is some confusion as to what is needed. On the System/36, the IF ACTIVE tested for an active procedure, not an active job in the sense of a job on the i5. The analogy on the i5 is to an active program. Unfortunately, if I am executing a program, I have no lock on the program. Another job can successfully execute an ALCOBJ command with *EXCL of the program. If I have an exclusive lock on a program, another job can still execute that program. I believe that the only suggestion that has been expressed here that works is the allocation of the data area. Of course, that means you need to put the code to allocate the data area into each program that you want to test as active (and you want to make sure it deallocates the object even if the program (but not the job) aborts). No doubt, the System/36 presented an easier interface.

                    Comment


                    • #11
                      TESTING FOR A SPECIFIC ACTIVE JOB

                      The iSeries does not place lock on a program when it is executed, however it is possible to perform the allocation yourself. So in the program MYLIB/MYPGM execute the following allocate object commands. Allocate when it starts and deallocate when it ends. ALCOBJ OBJ((MYLIB/MYPGM *PGM *SHRRD)) WAIT(0) DLCOBJ OBJ((MYLIB/MYPGM *PGM *SHRRD)) By doing this MYPGM will have an object lock that can be viewed using the WRKOBJLCK command, during the period of time the program is executing. What you need now is to write a tool using the “List Object Locks” QWCLOBJL API. Using this API you will be able to place the same information displayed by WRKOBJLCK command into a user space. This makes it possible for your to write a tool to check object locks. Use this new tool, call it IFACTIVE, in the other programs that need to know if the first program is processing. Whether you allocate the program, or the data area does not matter. I would always recommend that you avoid using exclusive locks.
                      Code

                      Comment


                      • #12
                        TESTING FOR A SPECIFIC ACTIVE JOB

                        There is an s/36 ocl command that is used to test for specific jobs being active, example: // IF ACTIVE-'ARUPDT' RETURN How is this done using CL?

                        Comment

                        Working...
                        X