Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Job Control Language is a means of communication between a program that can be written in COBOL or Assembler or PL/1 & MVS operating system. Why JCL? Job Control language is a flexible, powerful and unique language that runs in an IBM Mainframe environment. In addition to above charateristics, it appears to be quite incomprehensive and not user-friendly. Unlike programs written in programming languages like C, C++, PASCAL, FORTRAN, and COBOL etc. compiled under PC, MS-DOS or UNIX operating systems for the programs written in such languages to run on IBM-mainframe environment you have to submit the job to mainframe operating environment through JOB CONTROL LANGUAGE (JCL). JCL was created at a time when "user friendly" environments were not an issue, instead power and flexibility were. Job is a collection of statements that specify the resources required to run the job by the operating system. A mainframe is one of the greatest creation of mankind. It is something like, if you are working with the mainframe that actually means that you are the person working with the REAL computer with your colleagues. JCL is not a procedure Oriented Language like COBOL, PASCAL, C.. ect. JCL is not a Object Oriented Language like C++ or small talk. It has a uniquely identifying characters of its own, it is a job control language. JCL will identify to the operating system the resources that your program expects to use. It is the interface between the Application program and the MVS operating system that your program will run in. Without JCL your programs will not run in the IBM-Mainframes.
INTRODUCTION TO JCL WHAT IS JCL? STRUCTURE OF JCL
Using JCL you can tell the system what program(s) you want to run; what datasets these program(s) will be using; what should be done with those datasets once the program(s) end(s). JCL statements are used to input this information to the system. JCL is used to describe these Jobs.
JCL
Each Step has its own set of Data definitions. All the Steps in a Job are executed sequentially i.e. one after the other. A JCL statement consists of one or more 80-byte records. A Continued JCL statement can begin in column 4-16. Each statement is divided into the five fields: 1. IDENTIFIER FIELD Indicates a JCL statement: - // in columns 1 and 2 of all JCL statements except the delimiter. - /* or installation designated characters in columns 1 and 2 as a delimiter. - //*in columns 1,2, and 3 depicts a comment statement 2. NAME FIELD Identifies a statement so that it can be referred to later: - Must begin in column 3. - 1-8 characters in length (alphanumeric or national(#,@,$)) - First character must be alphabetic or national. - Must be followed by at least one blank. 3. OPERATION FIELD Specifies the type of statement or command: - Follows the NAME Field - Must be preceded and followed by at least one blank. - Consists of characters specified in syntax for statement. 4. PARAMETER FIELD Contains parameters separated by commas: Follows the OPERATION field. Must be preceded and followed be at least one blank Consists of two types: Positional Keyword
5. COMMENT FILED: Can contain any information: - Follows the PARAMETER field - Must be preceded by at least one blank - Difficult to use. Comment statement is recommended.
JCL
ACCOUNTING INFORMATION AND PROGRAMMER NAME CLASS MSGCLASS NOTIFY MSGLEVEL REGION TIME RESTART
JCL
Code the different JOB statements depending on the need of the Job
JCL
Appears at the bottom of every page of printed output for the Job. Examples: //MYJOB JOB MTPLACC25,'Ryaz Ahmed',. //YOURJOB JOB ,'Probir Bairagi',. //HISJOB JOB MTPLAC30,,.. Each Step signifies the execution of a Program. Each Step has its own set of Data definitions. All the Steps in a Job are executed sequentially i.e. one after the other.
A JCL statement consists of one or more 80-byte records. A Continued JCL statement can begin in column 4-16. Each statement is divided into the five fields: 1. IDENTIFIER FIELD Indicates a JCL statement: - // in columns 1 and 2 of all JCL statements except the delimiter. - /* or installation designated characters in columns 1 and 2 as a delimiter. - //*in columns 1,2, and 3 depicts a comment statement 2. NAME FIELD Identifies a statement so that it can be referred to later: Must begin in column 3. 1-8 characters in length (alphanumeric or national(#,@,$)) First character must be alphabetic or national. Must be followed by at least one blank.
3. OPERATION FIELD Specifies the type of statement or command: - Follows the NAME Field - Must be preceded and followed by at least one blank. - Consists of characters specified in syntax for statement. 4. PARAMETER FIELD
JCL
Contains parameters separated by commas: Follows the OPERATION field. Must be preceded and followed be at least one blank Consists of two types: Positional Keyword
5. COMMENT FILED: Can contain any information: - Follows the PARAMETER field - Must be preceded by at least one blank - Difficult to use. Comment statement is recommended. CLASS Type : Keyword parameter Purpose: To assign a Class to the Job. Syntax: CLASS=Class (1 Character. Installation dependent. 'A' thru 'Z' and '0' thru '9') Example: CLASS=X As we have seen in Unit 1, the Class of a Job determines the input priority (a basis for Initiator selection) As most installations do not prefer the users specifying the dispatching priority for their Jobs, the Class parameter provides a less explicit way to specify the input priority. For example, the user might select a Class, which most Initiators can handle. MSGCLASS Type: Keyword parameter Purpose: To specify how the Job's output is to be handled. Syntax: MSGCLASS=Message-class
JCL
(1 character. Installation Dependent. 'A' thru 'Z' of '0' thru '9')Example: MSGCLASS=A Using the MSGCLASS parameter, you can tell the system how to handle the output of your Job. The valid values that you can specify for this parameter are dependent on your installation. In one installation, MSGCLASS=Z may mean that the output has to be immediately routed to a printer. In another installation, it may mean that the output has to be held in the Output Queue for later retrieval.
NOTIFY Type: Keyword parameter Purpose: To specify which user is to be notified after the Job finishes execution. Syntax: NOTIFY=User-Id (Any valid User ID defined to RACF) Example: NOTIFY=USERID NOTIFY=MAIN006 Once the Job ends execution, in case someone has to be notified about the completion along with the maximum return-code (discussed later) of the Job or, the Abend Code, the NOTIFY parameter has to be used. Once the Job finishes, if the user specified in NOTIFY has logged on, he will get the message once he presses ENTER or any other Attention Identifier Key. If he is not logged on, he will get the message(s) along with his logon prompts the next time he logs on.
MSGLEVEL Type: Keyword parameter accepting 2 positional parameters. Purpose: To specify how much output has to be generated for this Job by the system. Syntax: MSGLEVEL=(a,b) a: Specifies how much of the Job has to be printed in the output (job log). Valid values are 0, 1 and 2 0 - Print only the Jobcard (JOB statement of the Job)
JCL
1 - Print all JCL and JES statements including all statements in procedures, if any 2 - Print only submitted JCL and JES statements. Statements in procedures are not printed. b: Specifies which messages will be printed in the output (job log). Valid values are 0 and 1 0 - Print All the messages only if the Job abends (abnormal termination). 1 - Print All the messages regardless of the outcome of the Job how the job terminates Examples: MSGLEVEL=(1,1) MSGLEVEL=(,1) MSGLEVEL=(2,) REGION Type: Keyword parameter Purpose: To limit the maximum amount of memory that the Job can utilize. Syntax: REGION=nnnnnnnK or REGION=nnnnM n: Numeric value
Valid ranges :
0 thru 2047000 in case of K 0 thru 2047 in case of M K: Kilobytes M: Megabytes Examples: REGION=1024K REGION=1M
JCL
REGION need not be explicitly coded unless specified in the documentation for certain utilities. If REGION=0K or REGION=0M is coded, the system assumes a default region size.
TIME Type: Keyword parameter Purpose: To specify the maximum processor time that the Job can utilize. TIME = (minutes, seconds) ON JOB STATEMENT MAX CPU TIME FOR JOB ON EXEC STATEMENT MAX CPU TIME FOR STEP 1. The TIME parameter can be used to specify the maximum length of CPU time that a job or job step is to use the processor. 2. If coded on the JOB statement, this is the total time for all steps. 3. If coded on an EXEC statement, it is the maximum time for this step. 4. Any combination of minutes and seconds can be coded. However, there are three values for the parameter that have a special meaning: TIME=NOLIMIT means the job or step is not to be timed. TIME=1440 is equivalent to coding TIME=NOLIMIT. Thus 1440 is the only numerical value of TIME that is not to be interpreted literally. ( This indicates that the job will not be timed.) TIME=MAXIMUM means the job or step will be allowed to use to 357912 minutes. ( this is about 8.25 months of processor time) If coded on the JOB statement and any step causes the total time to be exceeded, the job is abnormally terminated. If not coded, the JES installation default is used. EXAMPLE
The entire job will be limited to a maximum of 1 minute and 30 seconds. The first step will be limited to a maximum of 1 minute.
JCL
Note that the submitter is apparently asking that the last step not be timed.However, coding TIME=NOLIMIT on the last step will NOT accomplish this Objective. The TIME=(1,30) on the JOB statement will limit the maximum time for step 3 to 1 minute and 30 seconds. What will be the minimum time available to step 3? How could the submitter modify the JOB statement time so that step 3 would not be timed?
RESTART Type: Keyword parameter Purpose: To begin the execution of the Job from a Step other than the first one. Syntax: RESTART=Stepname Example: RESTART=STEP2 If you want to skip one or more of the initial steps in the Job before starting execution, use the RESTART parameter. For example, if you have run a Job with 2 steps, the first step runs and the second step abends. You make the changes in the second step to set right any error causing statement or parameter. Now, you will require running only the second step. Therefore, you change the Job statement and add the RESTART parameter to start execution from the second step onwards. If the time consumed by a job (or step) exceeds the value specified for the TIME parameter for that job (or step), the job ABENDS.
TYPRUN Type: Keyword parameter Purpose: To control the type of execution for the Job. Syntax: TYPRUN=SCAN TYPRUN=HOLD TYPRUN=COPY SCAN: Only check the Job for syntax errors. Do not execute the Job. HOLD: Check the Job for syntax errors and hold it in the Input Queue.
10
JCL
COPY: Send the Job directly to the Output Queue. With SCAN, the Job gets checked for syntax errors. The output, including error messages, if any, is directly sent to the Output Queue. With HOLD, the Job is checked for syntax errors. If no errors are present then, the Job is held in the Input Queue from where the operator will have to release it for execution. With COPY, no syntax checking or execution takes place. The source content of the Job immediately gets directed to the Output Queue.
Knowledge supposedly gained after this unit A thorough understanding of the purpose of the JOB statement The most important parameters for the JOB statement Coding and identifying different types of JOB statements depending on the requirements of the Job
11
JCL
REGION TIME PARM
Examples
The EXEC statement accepts one positional keyword parameter and other keyword parameters. Example: //Stepname EXEC PGM=Program-name or //Stepname EXEC PROC=Procedure-name or //Stepname EXEC Procedure-name
12
JCL
PGM=MYPROG
PROC
Type: Positional keyword parameter Purpose: To name the Procedure to be executed in the step. Syntax: PROC=Procedure-name Example: PROC=MYPROC
REGION Type: Keyword parameter Purpose: To specify the maximum memory that the step can utilize. Syntax: REGION=nnnnnnnK or REGION=nnnnM Examples: REGION=1024K REGION=1M TIME
Type: Keyword parameter Purpose: To specify the maximum processor time that the step can utilize. Syntax: TIME=(mm,ss) m: minutes s: seconds TIME=MAXIMUM
13
JCL
TIME=NOLIMIT TIME=1440
PARM
Type: Keyword parameter Purpose: To pass data to the load-module being executed in the step. Syntax: PARM=value Example: PARM='ABCDEFGH'
DD Statement
Purpose of the DD statement Syntax Parameters DSN DISP SPACE VOL UNIT DCB SYSOUT
PURPOSE OF DD STATEMENT
14
JCL
The DD statement is required for the following reasons - To define the datasets to be used by the step - To create new datasets - To manipulate existing datasets - To specify all the dataset attributes while creating new datasets - To provide instream data to programs - To send information to the printer via the spool
SYNTAX OF DD STATEMENT
The DD statement accepts keyword parameters. Example: //DDname DD parameter,paramter,
DISP
Type: Keyword parameter that accepts positional parameters Purpose:
15
JCL
Three-fold , to specify, 1) The status of the dataset at the beginning of the step. 2) Action to perform on the dataset if the step completes normally. 3) Action to perform on the dataset if the step abends.
Syntax:
Type: Keyword parameter that accepts positional parameters Purpose: To specify the space requirements for new datasets Syntax:
CYL - requests allocation in terms of cylinders. Numeric value - requests allocation in terms of blocks with size specified by the numeric value. Primary Quantity: Specifies the amount of initial allocation for the dataset in terms of the unit specified. Secondary Quantity: Specifies the amount of additional allocation for the dataset in terms of the unit specified once the primary quantity is exhausted. Directory Blocks: Specifies the Directory Blocks the dataset is to have. Any value greater than 0 creates a PDS. Coding 0 in this parameter or skipping it altogether creates a sequential dataset.
16
JCL
VOL
Type: Keyword parameter that accepts keyword and positional parameters Purpose: To specify the Volume on which the dataset exists or needs to be created. Syntax: VOL=SER=volume-serial-number
UNIT
Type: Keyword parameter which accepts positional parameters. Purpose: To specify what type of device the dataset resides on or should be created. Syntax: UNIT=Generic-unit-name or UNIT=Unit-model-number or UNIT=/Machine-address Example: UNIT=SYSDA
DCB
Type: Keyword parameter that accepts keyword parameters Purpose: To tell the system about the characteristics of the dataset Syntax: DCB=(LRECL=nnnn,BLKSIZE=nnnn,RECFM=record-format) LRECL - Specifies the maximum length of a record in the dataset. Values can range from 1 to 32760 bytes. BLKSIZE - Specifies the maximum length of a block in the dataset. Values can range from 18 to 32760 bytes. RECFM - Specifies the format of the records in the dataset i.e. fixed, variable, blocked, undefined etc. Examples:
17
JCL
DCB=(LRECL=80,RECFM=FB,BLKSIZE=8000)
DSN=&TEMP //C DD DSN=&TEMP, UNIT=SYSDA, SPACE=(CYL,1) 1. A temporary data set is one that is created and deleted in the same job. 2. There are three ways to request the creation of a temporary data set: Omit the DSN. In this case the system will create temporary data set having a 44-character name. The system builds date, time, and other information into this name to ensure the name is unique. Code a name beginning with && such as DSN=&&WORK. The system will create a temporary data set having a 44-character name. The system builds date, time, and other information into the name to ensure its uniqueness. Code a name beginning with & such as DSN=&TEMP. The system will create a temporary data set with a 44-character name. The system creates a unique name containing date, time and other information. Names prefixed by && are preferable to those prefixed by &. A temporary data set is created and deleted in the same job. It cannot be kept after the end of job. To avoid ambiguity use the form, DSN=&&TEMP. To retain the dataset even after the current step ends, the temporary dataset has to be passed to the next step by coding PASS in the second sub-option of the DISP parameter. If you have a Job of 3 step and you want to pass a temporary dataset from the 1st step to the 3rd step then, - Pass it from the 1st step to the 2nd - Pass it from the 2nd step to the 3rd.
18
JCL
You can use referbacks if you don't want to explicitly code the value for parameters. Rather, you can obtain values from the same parameters in other steps.
The presence of the '*' above indicates that a backward reference is being used Many parameters in JCL statements can use a backward reference to fill in information. A backward reference (or referback) is a reference to an earlier statement in the job or in a cataloged or instream procedure called by a job step.
STEPLIB Default search PDS for the load-module being run in the step JOBLIB Default search PDS for the load-modules in the entire Job SYSPRINT Default output dataset for printable outputs SYSOUT Default output dataset for system messages SYSIN Default instream input dataset for most programs
Concatenation is the method of combining 2 or more datasets and making them behave as a single file from the point of view of the program. In case of input datasets records will be read in from files in the same order as specified in the concatenation i.e. start reading from the first file, once there are no more records in the first file, continue with the second file and so on until the last file is read. Only then will the system encounter the end-offile condition. In case of output datasets, writing will start from the first dataset. Once all the space in the first dataset is exhausted, the next dataset in the concatenation order will be written to and, so on.
PROCEDURES
What is a Procedure? Instream and Cataloged Procedures The PROC and PEND statements The JCLLIB statement
19
JCL
Symbolic parameters
WHAT IS A PROCEDURE?
For jobs that you run frequently or jobs that use the same JCL, pre-code job control statements into procedures. Procedures consist of one or more complete steps. Every procedure must be given a name. Procedures are invoked via the E XEC statement. Three benefits of using procedures:
Saves time by reducing the time required to code JCL. Saves library storage by eliminating duplicate JCL. Reduces JCL errors by providing access to debugged JCL. Example: //STEP or // STEP EXEC EXEC PROC=procedure name procedure name
INSTREAM PROCEDURE
When you place a procedure in the job input stream, it is called an instream procedure 1. Primarily used to test procedures. 2. Reside in the job input stream and can be called only from that job stream. Instream Procedures are those which are coded in the same member which contains the Job that uses them. Instream Procedures can only be used by the Jobs that contain them.
CATALOGED PROCEDURES
A procedure cataloged in a library is called a CATALOGED PROCEDURE. Can be called when needed Resides in a procedure library. Cataloged Procedures are those which are contained in separate members and, are used by Jobs coded in different members. Cataloged Procedures can be used by any Job coded in any member. Procedures cannot contain JOB statements DD * statements
20
JCL
DD DATA statements Delimiter statements('/*' followed by 78 blanks) Null statements('//' followed by 78 blanks) Non JCL statement(for example, JES or utility control statement)
CATALOGED PROCEDURES
//MYPROC PROC A=LP2WK1,B=SYSDA //STEP1 EXEC PGM=IEFBR14 //DD1 DD DSN=A.B.C,DISP=SHR, // VOL=SER=&A, // UNIT=&B // PEND //STEPX EXEC MYPROC,A=LP1WK1,B=SYSSQ At Run-time: //STEP1 EXEC PGM=IEFBR14 //DD1 DD DSN=A.B.C,DISP=SHR, // VOL=SER=LP1WK1, // UNIT=SYSSQ
UTILITIES 21
JCL
OS/390 UTILITIES Utility Control Statement Syntax The IEBGENER Copy (card-disk) Utility. The IEBGENER Copy/Print Utility. The IEBGENER Utility The IEBPTPCH Utility The IEHLIST Utility The IEBCOPY Utility The IEHPROGM Utility The IEBUPDATE Utility The SORT Utility The MERGE Utility
OS/390 UTILITIES
Utilities are IBM-supplied programs that are intended to perform certain routine and frequently occurring tasks in the OS/390 environment.
Utilities are also used to allocate,update,delete,catalog and catalog data sets, and also to list the contents of VTOC.
22
JCL
----control statements----/* //SYSIN DD DSN=MAINTEC.CTLLIB(MEM),DISP=SHR Utility control statements must be coded in columns 1 thru 71.
23
JCL
Example: //STEP1 EXEC PGM=IEBPTPCH //SYSPRINT DD SYSOUT=* //SYSUT1 DD DSN=ABC.REC,DISP=SHR //SYSUT2 DD SYSOUT=* //SYSIN DD * PRINT TYPROG=PS,MAXFLDS=2 TITLE ITEM=('EMPLOYEES PROFILE',27) TITLE ITEM=('NAME ADDRESS',15) RECORD FIELD=(8,2,,10),FIELD=(5,10,,20) FIELD=(LENGTH OF FIELD,POSITION IN INPUT,COVERSION,POSITION IN OUTPUT)
The IEHLIST utility is used to list entries in a PDS directory. Example: //STEP1 EXEC PGM=IEHLIST //SYSPRINT DD SYSOUT=* //DD1 DD DISP=OLD,UNIT=SYSDA,VOL=SER=ABC //SYSIN DD * LISTPDS DSNAME=MTPL.FILE,VOL=SYSDA=ABC The IEBCOPY is used for copy operations on members of partitioned datasets. Example: //STEP1 //SYSPRINT //IN //OUT //SYSIN EXEC DD DD DD DD * PGM=IEBCOPY SYSOUT=* DSN=MTPL.FILE1,DISP=SHR DSN=MTPL.FILE2,DISP=SHR
24
JCL
COPY OUT DD=OUT, INDD=IN SELECT MEMBER=ALLOCATE SELECT MEMBER=((PROD,TEST,R)) /*
//SYSIN DD * . / CHANGE NAME =MEM,UPDATE=INPLACE HARRIS DICKENSON 00000050 MARY THOMAS 00000070 . / ENDUP /*
Example:
25
JCL
//STEP1 //SYSOUT // SORTIN //SORTOUT //SYSIN EXEC DD DD DD DD * PGM=ICEMAN SYSOUT=* DSN=MTPL.SEQ1,DISP=OLD DSN=MTPL.SEQ2,DISP=OLD
SORT FIELDS=(21,2,CH,A)
EXEC SYSOUT=* DD DD DD
26