Program Interception

This TestBench facility enables any CALL made by any program defined within a Process to be intercepted. Such CALLs include not only those made directly by the program under test, but also by any program it calls, and so on throughout the program stack. This option cannot be used if the CHGSYSLIBL command is not being used – see later System Library Pre-checker section for more information.

When a program has been defined for interception the available actions are to alter or set the parameter values that the standard program would have returned if it had not been intercepted.

The applications for program interception fall into four categories:

• You wish to monitor and check the parameter values being passed between programs, without impacting either the calling or called program.
• If a program does not currently exist, perhaps because one stage of a development has yet to complete, it will still be possible to test other modules by intercepting the CALLs to the yet to be created programs and returning the designed parameter values.
• To assist in problem determination, program interception allows a known set of parameter values to be returned from any CALL, to assess the function of the program under test if the sub-programs return the designed parameter values.
• If a program to be called exists, but for the purpose of the current Test Case it returns inappropriate parameter values, the CALL can be intercepted and the appropriate values forced into the returned parameters. An example might be where a program is to be tested at a future date but it issues a CALL to a sub-program which returned the date of the next working day. As this sub-program is file driven, manipulation of the current processing date will have no effect on the sub-program. In this instance the CALL can be intercepted and the desired date for the next working day can be forced as the returned parameter value.
TestBench does not support interceptions of the CALLB operation.

Interception Definition
There are three steps to the creation of a program interception:

  1. Define the parameter structure of the called program using the standard facility as that used to define a Process (option 7 below).
  2. Define the parameter data sets, again using the standard facility as that used to define Process parameter values (option 8 below). The Values To Return should always be specified irrelevant of the type of interception, while the Received Values should only be specified for Conditional interceptions.
  3. Define whether a Log Call, Conditional or Sequential interception is required. It is possible to change from one to the other without changing the parameter values.

F6 – Add Enter the name of a program to be intercepted. Press F4 on the program field to display a list of programs called directly by the Process Execution Program. This will not include any programs called by variable reference. Multiple selections can be made at one time on this screen.

Log Call
Use this option to trap the parameter values being passed between the caller and the called programs. As the program is called, the parameter names and values are logged within TestBench. When the called program ends, again the parameter values are saved. This information can be viewed in Results using option 3 (parameters) which shows Tracked Programs. Neither program is affected by the logging of the parameters.

Sequential Interceptions
This interception option is used where either a single parameter data set is to be returned as parameters from the called program or multiple parameter data sets are to be returned in sequence.

It should be noted that when the number of CALLs to the sub-program exceeds the number of parameter data sets that have been defined, TestBench will start processing the parameter data sets again.

Example
There are three parameter data sets that have been defined with descriptions of ‘A’, ‘B’ and ’C’. The parameter data sets will be returned to the calling program as follows:

1st CALL    Set ‘A’
2nd CALLSet ‘B’
3rd CALL    Set ‘C’
4th CALL    Set ‘A’
5th CALL    Set ‘B’

Conditional Interception
This interception option should be used when the parameter data set to be returned is conditional upon the input parameter values that accompanied the CALL.

If no parameter data set exists with conditions which match the input parameter values then no changes will be made to any of the parameter values.