SetExitTrap Method
The SetExitTrap method flags the currently executing program line as a breakpoint for a subsequent exit call. If a routine with an exit trap set calls other routines and any routine calls the exit function, the current interpreter stack is rolled back—as if each routine called the return—until the routine is found with an exit trap set. The routine with the exit trap then resumes executing at the SetExitTrap call.
This method has the following syntax:
integer = ProcExec.SetExitTrap()
If the method returns 0, the exit trap was set.
If the method returns 1, the SetExitTrap was invoked by an interpreter stack rundown initiated by a call to the exit function.
The following 4GL example shows the use of the SetExitTrap method:
procedure topproc() =
declare
istat = integer not null;
enddeclare
{
istat = CurProcedure.SetExitTrap();
if istat = 0 then
callproc nextproc();
else
message 'nextproc called exit';
endif;
};
procedure nextproc() =
{
exit;
};
An OpenROAD 4GL procedure, userclass method, user frame, and ghost frame can have only one exit trap at a time. If the SetExitTrap method is called more than once while running a given routine, each call supersedes the previous setting.
Last modified date: 06/25/2024