CALLJCL
You can use this function to call a user-written program directly from a script. Only one parameter can be passed to the program being called. The program being called must be defined either in LINKLIB or in STEPLIB of the job running the script. The parameter is passed to the user-written program by using the same linkage that is used when passing a JCL PARM statement to a program. Only character variables can be passed to the user program. Character data is passed as a string of characters.
The program called by the CALLJCL function, should not update any of the variables. Variables cannot be updated from the called program. The only data that can be passed back to the script file is the return code. Variable %RC is updated with the return code set by the called program.
If the program defined in the CALLJCL function is not found, an error is displayed and the script is terminated. If an abend occurs while in control of the user-written program, error messages are displayed and the script is terminated.
The format of this function is CALLJCL program_name parameter_data. For example, CALLJCL USERPGM %CHARDATA. This command calls the USERPGM program and passes a parameter to the program. Assume that the variable is set in the following way: %CHARDATA = "TESTDATA". When control is passed to USERPGM, R1 points to the address of an address list containing an address:
R1 —> Address (parameter 1) —> X'0008' (the length of data passed), TESTDATA (the data passed)