The JCL starts with a JOB operation. This line is about the job not the program to execute.
In case the JCL contains a program execution chain, a given program and its execution environment is organized around its EXEC operation. The JES will not execute it unless all the necessary parameters etc. (defined by the program) is not given after the EXEC statement. The lines connected to the given program is called a program block.
When all the necessary statements are given, the JCL is correct for syntax, and the defined datasets are available, the OS will execute the program by following the program block.
A program block is identified by its EXEC name.
After execution, the JES gives back the Return Code (RC) of the actual EXEC operation. The RC can be compared with a numeric literal or used in other ways.
The EXEC name defines a JCL block. The return code can be used
generally (the last return code is tested)
specifically (the return code of the specific EXEC is tested)
EXAMPLE FOR A JCL HEADER:
EXAMPLE FOR A PROGRAM BLOCK:
In the JCL, conditional structure can be established by using the IF/ELSE/ENDIF statements. The ELSE is optional, the ENDIF is obligatory.
Optionally, the IF phrase can be named as other statements in JCL. When using names for IFs:
helps to identify the beginning of the condition in the code
when reaching the condition, the JES joblog will received a line showing the name and the TRUE/FALSE value of the condition
Because of the line length limit, the branches are ususally written on the same intendation than the conditional keywords. Due to this, it might be hard to identify the conditional levels in case of nested structure. Therefore:
nested conditional statements are supported but discouraged
using names when having multiple IFs is advised (named conditional structure)
The general test is (last program):
//[IF name] IF RC = <value> THEN
The program block specific test is:
//[IF name] IF <EXEC name>.RC = <value> THEN
EXAMPLE FOR SYNTAX OF CONDITIONAL STRUCTURE:
EXAMPLE FOR USING CONDITIONALS WITH THE GENERAL RETURN CODE:
EXAMPLE FOR USING CONDITIONALS WITH SPECIFIC RETURN CODES:
EXAMPLE FOR JES OUTPUT FROM NAMED CONDITIONALS:
EXAMPLE FOR NESTED NAMED CONDITIONALS:
In JCL there is no iteration. In case of multiple running, repeat the needed lines.
JCL strategies in financial environment are utilizing multiple program execution and using DISP argument variations.
The VSAMs in time use to become fragmented on data and-or index level, the integrity of CI/CA damages, or gets slower. That means from time to time a VSAM reload becomes necessary.
FIGURE OF VSAM RELOAD/REFRESH STRATEGY:
EXAMPLE FOR VSAM RELOAD/REFRESH WITH SORTING: