AS/400: Ending call stack up to a particular program

55 pts.
Tags:
AS/400 Call stack
AS/400 jobs
Hello All, I have a question. Here is the scenario: A job calls PGM A and it in turn calls PGM B. Note: Both A and B are ILE programs and created with activation group, *CALLER. PGM A ******** /Free ................... ................... CallP PGM B (Parm1: Parm2); Var1 = Parm2; ................... ................... /End-Free ********* Is there any API or function or logic that I could use that would enable me to return control back to the line soon after the call to PGM B (i.e. Var1 = Var2). If there is an error (exception or validation or whatever) in PGM B (or any calls from it), I need to end everything upto and including PGM B "NORMALLY" and return back to A. I could use CEETREC or C Function Exit(), but I guess that would require me to put PGM B in a separate activation group. Or else, it would end up ending PGM A as well as my main job everytime an error occurs. Is there an easy solution or am I asking for too much :(

Answer Wiki

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

Hi,

Why would you want to continue and trasfer control back to PGM A? Anyway, there are ways to handle run time errors or program exceptions in RPG. It depends on the error.

If you want, you can use the *PSSR subroutine. This subroutine will be executed when a program exception occurs. From there you can issue a RETURN statement and transfer control back to the calling program. But afterwards, what then?

Regards,

Allan

Discuss This Question: 1  Reply

 
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
  • Compengr2003
    To answer the first qn - I need to transfer control back to PGM A (XML parser and composer program) because I need to generate an error CML with appropriate info. Again, I have handled program exception errors with a *PSSR. But for validation errors also, I need to stop processing and exit out of B. The procedures are deeply nested and hence mere return might not help to end PGM B completely.
    55 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