AS/400-Program Completion – Message ID

315 pts.
Tags:
AS/400
AS/400 error messages
AS/400 programming
Program Completion
Is there any message ID in CL to check whether a program is completed or not? Suppose I have called PGM-B from PGM-A. In PGM-A I want to check whether PGM-B is completed successfully or not. Is there any message ID for this cause.
ASKED: December 29, 2010  11:29 AM
UPDATED: December 30, 2010  12:24 PM

Answer Wiki

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

What are you trying to accomplish?
If you have a CL program like this:
PGM-B
PGM
CPYF xxx
Call PgmA
/* Did program A finish OK */
IF PGMA = ‘OK’
/* other commands here */
EndPgm
==
When PGM-A is called, it will run until completed and control will automatically retunr to this the original program.
If PGM-A had any errors, it would crash unless you had MONMSG to capture error. IF you need to know if that happened, you would need to set a variable and return that to the calling program.
If PGM-B is running and you want to know if it is past the call to PGM-A, you can do a WRKJOB and take option 11 to see the call stack.

Discuss This Question: 3  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
    Generally, if PGMA calls PGMB, you check to see if PGMB failed. There is no reason to check if it completed normally since you already know that it completed normally because it didn't fail. So, no, there is no message identifier unless you deliberately code one into PGMB. But please clarify if PGMA CALLs PGMB or if PGMA submits PGMB for batch processing. Those are two very different situations. Tom
    125,585 pointsBadges:
    report
  • sudheer794
    Hi Tom & Charlie, Here I would like to know do we have any MONMSG ids to track the program & job completion status. Thanks, Sudheer
    315 pointsBadges:
    report
  • TomLiotta
    I would like to know do we have any MONMSG ids to track the program & job completion status. No. If this is a submitted job, you can't use MONMSG to track completion. That wouldn't make sense because there is no way to know when a submitted job might run nor how long it will take. The job queue might be held, the batch subsystem might be inactive, there might be other batch jobs occupying the subsystem. The SBMJOB command has a MSGQ() parameter. A completed job will send a message to that message queue when it completes. Your program can receive messages from that message queue if you want to know about completion. 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