Hello Tim,
If program A is doing a call then that program is waiting on the called 
program to end and return control to program A.
From your description you can't change any of the called programs so I am 
guessing you have no idea of what error occurred, just that an error has 
been detected.
So here is one suggestion that might help or might not.
Change program A to submit the call to new program X
Create a data queue to allow messages from program X to program A
Program X receives the parameters necessary to call program B
  Program X calls program B
  Then it monitors the call for any error.
  If an error is detected it puts a message on a data queue indicating an 
error occurred.
  If no error it puts a message on the data queue indicating success
  Then ends. 
Program A
  Create a data queue suitable for receiving messages from program X to 
let you know an error has occurred.
  After the sbmjob to run program B using program X do a receive on the 
data queue, this will cause the program to wait until either progrram B 
and subsequent calls completes or fails.
  Respond to the user as required.
  Now submit the next program B via program X
Cheers
Don
From:   "Tim Adair" <tadair@xxxxxxxxxxxxxxxx>
To:     rpg400-l@xxxxxxxxxxxxxxxxxx
Date:   22/02/2024 08:02 AM
Subject:        Error handling over multiple call levels
Sent by:        "RPG400-L" <rpg400-l-bounces@xxxxxxxxxxxxxxxxxx>
Given the following scenario:
PROGRAM A calls Program B.  Program B calls Program C.  Program C gets 
an error (of any kind).
Is there any way to notify Program A that program C had an error, 
without losing my place in program C.
I'm writing in RPGLE (interactive) Program A, which reads a file where 
each record contains the name of a (Program B) program.  These B 
programs are almost all CL programs that call RPGLE programs (which are 
the C-level programs).  If an error occurs in a C-level program, I want 
this communicated to program A which will notify the user, _BUT_ I don't 
want to lose (or automatically respond to) the error in program C.  I 
want program A to notify the user, but I still want to be able to 
manually deal with the original error in program C.
Now the kicker...  This must be done without modifying any of the B or 
C-level programs.  All the hoop-jumping must be done in the new A-level 
program.
Sorry if this is confusing.  If anyone can decipher the ravings of a 
lunatic, I would appreciate your thoughts.
Thanks.
~TA~
As an Amazon Associate we earn from qualifying purchases.