Inserting global variables

You can add global JCL substitution variables to your JCL procedures.

Before you begin

The same process can be used to add global variables for JCL procedures on any of the JCL Substitution tab pages.

About this task

The following process shows how to add global variables for a COBOL program.

Procedure

  1. To add a new global variable for a JCL procedure that is used with a COBOL program, open the COBOL Settings page of the property group editor.
  2. In the left pane of the window, select JCL Substitution.
  3. Click Insert Global Variable.
    The Insert Global Variable window opens.
  4. Select a variable name from the table.
  5. Click Insert.
    The variable name and value are added to the table. Repeat these steps as necessary to add other global variables.

Results

When you add global variables to the JCL Substitution page and then generate JCL or trigger a remote build or syntax check, a SET statement is generated just before the EXEC PROC statement. The following global variables are available:
PDS
Resolves to the partitioned data set to which the source member belongs.
TCPIPADD
Resolves to the workstation IP address.
MEM
Resolves to the source member for which a build, syntax check, or JCL generation action was requested.
HLQ
Resolves to the high-level qualifier of the resource for which the build, syntax check, or JCL generation action was requested.
MSUBSTR
Returns the member name substring that is based on starting and ending indexes that you specify.
USERID
Resolves to the user ID that is used to log on to the remote system.

Example

Assume that an installation customized the COBOL compilation JCL procedure to add a custom preprocess step, for example, that expands the COBOL source and would like to write the output of that preprocess to a separate partitioned data set. The preprocessed member can be the input to the compilation step. The preprocessed member has the same name as the original COBOL source file, and the preprocessed output is written to a separate data set. To write the output from the preprocess step to a partitioned data set, you can add the following DD statements to the procedure:
//*custom - preprocess 
//SYS012 DD DSN=PDS.NAME(&MEM),DISP=SHR ---> Writes the pre-processed output to PDS.NAME(&MEM) 
//... 
//*compile step 
//COBOL.SYSIN DD DSN=PDS.NAME(&MEM),DISP=SHR 
//.....

&MEM resolves to the source member for which a build, syntax check, or JCL generation action is requested, so the user can use the JCL Substitution page to insert the global variable MEM in the properties for the MVS subproject and does not have to insert it for every member.