public interface CallHandler
Here is a sample class that prints log messages on the system output before and after each CALL and CANCEL statement:
import com.iscobol.rts.CallHandler;
import com.iscobol.rts.IscobolCall;
import com.iscobol.rts.WithName;
public class MyCallHandler implements CallHandler {
private String getName(IscobolCall call) {
return call instanceof WithName ? ((WithName) call).getName() :
call.getClass().getName();
}
public void afterCall(IscobolCall call, Object[] argv) {
System.out.println("AfterCall: " + getName(call) );
}
public void afterCancel(IscobolCall call) {
System.out.println("AfterCancel: " + getName(call) );
}
public void afterCancelAll() {
}
public void beforeCall(IscobolCall call, Object[] argv) {
System.out.println("BeforeCall: " + getName(call) );
}
public boolean beforeCancel(IscobolCall call) {
System.out.println("BeforeCancel: " + getName(call) );
return true;
}
public boolean beforeCancelAll() {
return true;
}
}
To install this class in your runtime session, you will set:
iscobol.call_cancel.hook=MyCallHandler
Note that the instance of this class is shared among all the programs in the same run unit.
A separate instance is generated for every new Client in thin client environment and for every
program called via CALL RUN, but within a standard programs chain (e.g. PROGA calls PROGB, then
PROGB calls PROGC) the same instance of the hook class is used.| Modifier and Type | Method and Description |
|---|---|
void |
afterCall(IscobolCall call,
Object[] argv)
Defines the actions to be performed after returning from a called program.
|
void |
afterCancel(IscobolCall call)
Defines the actions to be performed after canceling a program.
|
void |
afterCancelAll()
Defines the actions to be performed after a CANCEL ALL statement.
|
void |
beforeCall(IscobolCall call,
Object[] argv)
Defines the actions to be performed before entering in a called program.
|
boolean |
beforeCancel(IscobolCall call)
Defines the actions to be performed before canceling a program.
|
boolean |
beforeCancelAll()
Defines the actions to be performed before a CANCEL ALL statement.
|
void afterCall(IscobolCall call, Object[] argv) throws CallOverflowException
call - the instance of the called programargv - the parameters that were passed to the programCallOverflowExceptionvoid afterCancel(IscobolCall call)
call - the instance of the cancelled programvoid afterCancelAll()
void beforeCall(IscobolCall call, Object[] argv) throws CallOverflowException, MapCallException
call - the instance of the called programargv - the parameters that were passed to the programCallOverflowExceptionMapCallExceptionboolean beforeCancel(IscobolCall call)
call - the instance of the cancelled programboolean beforeCancelAll()