ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Check if a job has ended

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

  • Check if a job has ended

    Hello guys, i am submiting a job inside a CLP, and need to know when it finishes so i can call another program interactively as soon as the submitted one finishes.

    The only way i would know how to do this is to check in a loop the state of the job, but that would consume all the cpu, so i am guessing there must be an api or something that could make the CL listen for an event of some sort and make this happen.

    Does anyone have a suggestion?

  • #2
    Re: Check if a job has ended

    Many possibilities...

    Have the batch program execute a change job to priority 50 when it starts and change back to 20 when it ends and just call it interactively.

    CHGDTAARA X 'WORKING'
    SBMJOB XXX
    DLYJOB 120 /* BEST GUESS ON HOW MANY SECONDS TO RUN BATCH JOB */
    LOOP:
    RTVDTAARA X &X
    IF (&X *NE 'WORKING') GOTO NEXT
    DLYJOB 10
    GOTO LOOP
    NEXT:


    Create a data queue. If data queue exists, job is running somewhere else. Interactive submits job then waits for data queue entry. Batch job send done message to data queue. Interactive deletes data queue when data received.

    Batch jobs normally send a message when they complete. Create a break handling program for the message queue. You can use the default user profile queue or create a special one. Google "break handling program" for examples.
    Last edited by Denny; May 24, 2010, 12:41 PM.
    Denny

    If authority was mass, stupidity would be gravity.

    Comment


    • #3
      Re: Check if a job has ended

      Actually the solution was much easier. The CL now just submits another CL, which uses regular call statements, so when the first one finishes, the second one runs, all while being submitted. Thanks

      Comment

      Working...
      X