CALL

Use the CALL statement to invoke scripts from within scripts.

Optionally, parameters can be passed between the called script and the calling script. The number of return values must match the number of OUTPUT variables defined in the called script, and the number of parameters passed to the called script must match the number of INPUT variables defined in the called script.

If the script name specified in the CALL is not found, the EX_NO_SCRIPT exception definition script is invoked. By default, the script is abnormally terminated. To handle a failed CALL statement in a different way, you need to write an exception handler for this condition, as described in EXCEPTION.

Syntax


This picture shows the syntax of the CALL statement.

Examples

CALL this_script;
CALL dir_search ( names, Wombat );
a, b, c = CALL read_rec_script ( x, y, z );

Procedure

To use the 3270 Script window’s Statements menu to define a CALL statement, follow this procedure:

  1. From the Welcome window, click on Applications —> 3270 Servers
  2. Selecting the CALL statement : Click Statements —> Call Script.

    The system displays the Call Script Definition window.

  3. Selecting the script : Type the name of the script to be called in the Script field, or click Script to select the required script.
  4. Specifying input parameters : To specify additional input parameters (if required), click the button next to Input Parameters, then Add.

    In the Value field that appears in the window, type the variable name of the input parameter, or click Value to display the Term Definition window to select the parameter.

    Repeat this as required.

  5. Specifying output parameters : To specify additional output parameters (if required), click the button next to Output Parameters, then Add.

    In the Result field that appears in the window, type the variable name of the output parameter, or click Result to select the parameter.

    Repeat this step as required.

  6. Adding the statement to the script : Click OK.

    The CALL statement is added to the script.