by MrSpock » Wed Oct 08, 2008 1:22 am
JCL (Job Control Language) is the language used to create batch jobs. Batch jobs run in the background and cannot communicate interactively with a user or with a terminal.
JCL is relatively simple and straight-forward. There are only a few constructs to be concerned with. Here's a simple example:
//JOBNAME JOB (ACCOUNTING DETAILS),CLASS=X,MSGCLASS=X,...
//STEP1 EXEC PGM=MYPROG
//DD1 DD DSN=MY.DATASET,DISP=...
The JOB statement identifies your job to the system. A valid JOBNAME is required. Almost everything on the JOB statement will be dictated by your site's standards, so check with those to see how your JOB statement should be constructed. There is only one JOB statement per job.
The EXEC statement tells your job what Program (EXEC PGM=) or JCL Procedure (EXEC PROCNAME or EXEC PROC=PROCNAME) to execute. A step name (STEP1 in the example) is usually provided, but is not mandatory. Again, your site's standards will dictate this. A program is an executable (compiled) object, sometimes known as a load module. A JCL procedure is just a collection of JCL statements that perform a specific repetitive function.
The DD, or Data Definition statement, defines all of the necessary input and output as required by the program. The author of the program will determine what the names of the Data Definition entries will be. There should be at least one unique DD statement for each required input or output dataset.
The job can pass parameters to the program by means of the PARM= parameter of the EXEC statement. A maximum of 100 characters can be passed from the job to the program.
The only way that a program can communicate to the executing job is via the RETURN-CODE special register. The program can pass a numeric value of 0-4095 to the RETURN-CODE register, which the job can interrogate once that step has completed. The job can then perform or skip certain steps based on the value of the RETURN-CODE register.
In most shops, production JCL is written and maintained by the Production Support team, based on the requirements set forth by the application development team.
CLIST, or Command List, is an interpreted programming language that allows you to develop automated TSO/E and/or ISPF processes. These programs will run in the foreground, i.e. within a TSO/E address space. CLIST is very rarely used in modern shops, and you'll find few programmers that know how to code in it.
REXX, or REstructued eXtended eXecution language, is an interpreted or (optionally) compiled programming language. It runs natively in the foreground within a TSO/E address space, or in the background from within an MVS address space. Many tools and products provide extensions that allow them to be accessed and/or automated from a REXX program.
As far as which language to learn, I can't really comment, since I don't know what your role is going to be. JCL is the easiest and, with a limited set of constructs, should take no time to learn. I'd suggest skipping CLIST all together. I'd suggest learning about MVS utilities, data storage, TSO/E and the library of TSO commands, then learning about ISPF and ISPF Services and ISPF EDIT macros before tackling CLIST or REXX.