Writing CL to run programs, need to monitor for program completion: IF/THEN?

50 pts.
Tags:
CL Program
IBM iSeries
Premier
I'm trying to write a process that will start a program, monitor it for completion and decide to either proceed to the next program if goes END OF JOB, or display a message and terminate the running CL if the program not have successful END OF JOB. I have written a CL that will run all the programs I need, but if the first program crashes for whatever reason, the CL doesn't know to stop. How can I have the CL monitor the program? My experience is with Iseries. Any suggestions can help point me in the right direction. . ------------------------------- edited: added info ------------------------------- My CLP is very simple, but this is what I have. PGM RUN PGM(abc1234) OPTIONS(abc1234) RUN PGM(abc1234) OPTIONS(def5678) RUN PGM(abc1234) OPTIONS(ghi901) RUN PGM(abc1234) OPTIONS(jkl234) ENDPGM Perhaps if the CLP can read the program job log and watch for "END OF JOB" to know it completed successfully before continuing to the next PGM. And if the job log doesn't display "END OF JOB" to display a custom message to notify me, require a reply to acknowledge, then terminate the CLP without continuing to the next PGM.

Software/Hardware used:
Iseries

Answer Wiki

Thanks. We'll let you know when a new response is added.

If you have one CLP that runs all the processes, you should be able to pass each individual process a parm that will return an indicator to cancel or proceed with the next step. (Or set somethnig in the *LDA)

Discuss This Question: 9  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • TomLiotta
    First suggestion is to show us what you have so far. It's much easier to see if a few minor changes can fix something that already exists than have some unknown number of others try to write code that they might never use from specs that aren't precise. You might get ten examples, and none will do what you need. -- Tom
    125,585 pointsBadges:
    report
  • EagerNewb
    My CLP is very simple, but this is what I have.PGMRUN PGM(abc1234) OPTIONS(abc1234) RUN PGM(abc1234) OPTIONS(def5678)RUN PGM(abc1234) OPTIONS(ghi901)RUN PGM(abc1234) OPTIONS(jkl234)ENDPGMPerhaps if the CLP can read the program job log and watch for "END OF JOB" to know it completed successfully before continuing to the next PGM. And if the job log doesn't display "END OF JOB" to display a custom message to notify me, require a reply to acknowledge, then terminate the CLP without continuing to the next PGM.
    50 pointsBadges:
    report
  • TomLiotta
    Your program executes "RUN" commands. What is that command? What does it do? It's not a native command. -- Tom
    125,585 pointsBadges:
    report
  • TomLiotta
    It's not necessary to read the joblog. Your program will know if the inner programs failed. But the methods are different depending on how "RUN" works. -- Tom
    125,585 pointsBadges:
    report
  • EagerNewb
    Hmm... I guess that RUN command is part of the Premier software.
    50 pointsBadges:
    report
  • EagerNewb
    It isn't much, but I found out that RUN starts the programs one at a time. The next program doesn't start until the first one is done (either successfully or not). If I was to replace RUN with SUBMIT, it would kick off all the programs at the same time. I need them to run one at a time consecutively so RUN is used in this circumstance.
    50 pointsBadges:
    report
  • TomLiotta
    How is "RUN" different from simply using a CALL command? The "RUN" command wouldn't seem to have any reason to exist unless it does some specific useful work that CALL doesn't do. One thing I would certainly expect would be some useful messaging (or a return code of some kind) that your CL could use. -- Tom
    125,585 pointsBadges:
    report
  • EagerNewb
    I tried replacing RUN with CALL, but it seems to be showing an error. I'm using PDM to edit and compile the CL's, if that is any different.
    50 pointsBadges:
    report
  • TomLiotta
    I tried replacing RUN with CALL, but it seems to be showing an error.   We can't tell much unless we know what the error is and where and when you see it.   To tell us what the error is, we first need to know the message identifier. The basic text can also be helpful. To say where you see it, it will be shown on the display or in a joblog. To say when you see it, it will be immediate when you type the command and press <enter>, or it might be when you compile the program, or it might be when you run the program.   We don't know what the "RUN" command does yet, so we don't know how CALL might be used. We can see that "RUN" has a parameter named OPTIONS(), but we don't know what that parameter does. And we also know that CALL does not have an OPTIONS() parameter.   The CALL command cannot be a direct replacement for "RUN". We need to know what "RUN" does.   Does it cause programs to run in batch? Does it log activity in a database? Does do completion tests? Does it control later programs? Does it send messages? If we don't know how it works, we can't do anything with it.   The full help text for the command should tell you what it does. And there should be documentation for the product that tells you how to use it. We don't have the product, so we can't learn what to do. You have to research the command.   Tom
    125,585 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following