Introduction to JCL (The EXEC Statement) PDF

Title Introduction to JCL (The EXEC Statement)
Author Haroon Ahmed
Course Operating systems
Institution Robert Morris University
Pages 20
File Size 1.3 MB
File Type PDF
Total Downloads 81
Total Views 124

Summary

Download Introduction to JCL (The EXEC Statement) PDF


Description

Introduction to JCL - The EXEC Statement Credits: This document contains content and illustrations that may also be found in the "Introduction to JCL" IBM Academic Initiative Courseware Power Point Presentations. Additional details and illustrations were added.

THE EXEC STATEMENT Each JCL can be made of many job steps. Each job step can execute a program directly or can call a procedure, which in turn executes one or more programs (job steps). The statement, which holds the job step program/procedure information is the EXEC statement. The purpose of the EXEC statement is to provide required information for the program/procedure executed in the job step. Parameters coded in this statement can pass data to the program in execution, can override certain parameters of JOB statement and can pass parameters to the procedure if the EXEC statement calls a procedure instead of directly executing a program.

EXEC Positional Parameters PGM

PROC

Description This refers to the program name to be executed in the job step. The program name is a complied and linked load module. This refers to the procedure name (often called a PROC) to be executed in the job step. A PROC is module that contains JCL code to be inserted with the existing JCL code. JCL Procedures enable complicated, prewritten JCL code to be reused without the developer understanding the complexity of system JCL programming. If the PGM statement is omitted, JCL assumes a PROC

Coding JOB Statements you learnt that the JOB statement has a particular coding syntax. Similarly, the EXEC statement too has to be coded using a particular JCL syntax. Like the JOB statement, the EXEC statement too has five fields. The EXEC statement format includes the following:

10-12-2015

Page 1

Introduction to JCL - The EXEC Statement     

Identifier Field (//): It occupies position 1 and 2 Name Field: It names the step starting in position 3 EXEC Operator Field: It states the JCL statement type Parameter Field: It is used to state the parameters used on an EXEC statement Comment Field: This field is optional

Shown here is an example where the step name is STEP1. The operator is EXEC and the positional parameter is defined by PGM=IEBUPDTE. What is IEBUPDTE? IEBUPDTE is a system utility program that the system invokes during the execution of STEP1. The step name STEP1 identifies the EXEC statement so that the subsequent JCL statements can refer to it. It is important for you to always follow the JCL step name coding rules while naming a step. Not doing so will lead to JCL errors. Following are the coding rules for the step name:  The step name must begin in position 3  The step name must be 1 to 8 characters in length  The first character in the name must be alphabetic character (A to Z) or national character (#, @, $).  The first character cannot be numeric (0 through 9)  The remaining characters can be upper case alpha numeric (A to Z and 0 through 9) or national characters  Special characters and spaces cannot be used in a step name

10-12-2015

Page 2

Introduction to JCL - The EXEC Statement Shown here are two step names STEP#FOUR and LA$JOE. Are both the names valid step names? The step name LA$JOE is acceptable because it fits all the requirements defined in the rules for coding a step name( the $ is one of the national symbols). However, STEP#FOUR is not a valid step name because it contains more than eight characters.

Step Name $STEP#5 RUN TWO *STEP4

Valid or Invalid Valid Invalid Invalid

EXAMPLE#12 runtwo

Invalid Invalid

Reason why Invalid? Step names may not include spaces First character may be national character (#, @, $), but not an asterisk Too Long JCL is not permitted lower case letters/

The Positional Parameter The parameter field follows the EXEC operator and may contain multiple parameters. The first parameter in an EXEC statement is a positional parameter that designates the program or procedure the system executes during the job step. This positional parameter is often coded like a keyword parameter using either PGM= or PROC=.

10-12-2015

Page 3

Introduction to JCL - The EXEC Statement EXEC Keyword Parameters

Description Used to provide parametrized data to the program that is being executed in the job step. This is a program dependent field and do not have definite rules, except that the PARM value has to be included within quotation in the event of having special characters.

PARM For example given below, the value "CUST1000" is passed as an alphanumeric value to the program. If the program is in COBOL, the value passed through a PARM parameter in a JCL is received in the LINKAGE SECTION of the program.

ADDRSPC

This is used to specify whether the job step require virtual or real storage for execution. Virtual storage is pageable whereas real storage is not and is placed in the main memory for execution. Job steps, which require faster execution can be placed in real storage. Following is the syntax: ADDRSPC=VIRT | REAL When an ADDRSPC is not coded, VIRT is the default one.

This specifies the accounting information of the job step. Following is the syntax: ACCT=(userid)

ACCT

DDRSPC

This is similar to the positional parameter accounting information in the JOB statement. If it is coded both in JOB and EXEC statement, then the accounting information in JOB statement applies to all job steps where an ACCT parameter is not coded. The ACCT parameter in an EXEC statement will override the one present in the JOB statement for that job step only.

ADDRSPC coded in JOB statement overrides the ADDRSPC coded in EXEC statement of any job step.

TIME

If TIME is coded in an EXEC statement, then it applies to that job step only. If it is specified in both JOB and EXEC statement, then both will be in effect and can cause time-out error due to either of it. It is not recommended to use TIME parameter in both the JOB and EXEC statement together.

REGION

If REGION is coded in an EXEC statement, then it applies to that job step only. REGION coded in JOB statement overrides the REGION coded in EXEC statement of any job step.

10-12-2015

Page 4

Introduction to JCL - The EXEC Statement Used to control the job step execution based on the return-code of the previous step.

COND

If a COND parameter is coded in an EXEC statement of a job step, then the COND parameter of the JOB statement (if present) is ignored. The various tests that can be performed using a COND parameter is explained in conditional Processing.

Several of the EXEC keyword parameters are duplicated from the JOB statement, e.g., ADDSPC, TIME, REGION, COND. JOB statement keyword parameters apply to all JOB Steps( EXEC), except when overridden by an EXEC keyword parameter. For example, if a JOB statement has not coded with a REGION option, then the system default will be used. But, if a JOB Step (EXEC) is coded with a REGION keyword parameter that that region job requirements will be used by JES What does PGM= designate? PGM= designates a program the system executes during the job step. Shown here is the syntax of PGM as a positional parameter in the EXEC statement. A Program is source code that has been compiled and linked and stored as a load module. COBOL programs are normally complied and linked once and then executed many times without being necessary to compile and link the source code. What does PROC= designate? A PROC= designates a procedure the system executes. The syntax of PROC as a positional parameter in an EXEC statement is shown here. The JCL Procedures are set of statements inside a JCL grouped together to perform a particular function. Usually, the fixed part of the JCL is coded in a procedure. The varying part of the Job is coded within the JCL. You can use a procedure to achieve parallel execution of a program using multiple input files. A JCL can be created for each input file, and a single procedure can be called simultaneously by passing the input file name as a symbolic parameter. Omitting the PROC= Keyword

10-12-2015

Page 5

Introduction to JCL - The EXEC Statement If you omit the PGM= or PROC= keyword, the operating system automatically looks for a procedure by the specified name. Shown here is an example of the syntax when omitting PROC= keyword in an EXEC statement is shown. For example, to call a procedure named MYPROC from a step named STEP3, you will need to code the EXEC statement as shown on the right.

10-12-2015

Page 6

Introduction to JCL - The EXEC Statement Popular Positional Coding Errors //STEP1 EXEC PGR=IEFBR14 //STEP1 EXEC PGM = IEFBR14

The misspelling of PGM (as PGR) in the EXEC statement shown here returns a JCL error. In this example the equal sign in the parameter field is preceded and followed by a space. The system interprets "PGM" as a procedure name and not as a keyword or the positional parameter of the EXEC statement. When this program executes, an error "NOT FOUND" may appear. You can fix this error by eliminating the spaces before and after the equal sign.

Types of JCL Procedures There are two types of JCL Procedures: Instream and Catalog. Instream Procedure When the procedure is coded within the same JCL member, it is called an Instream Procedure. It should start with a PROC statement and end with a PEND statement. In the this example, the procedure INSTPROC is called in STEP1 and STEP2 using different input files. The parameters DSNAME and DATAC can be coded with different values while calling the procedure and these are called as symbolic parameters. The varying input to the JCL such as file names, data cards, PARM values, etc., are passed as symbolic parameters to procedures. While coding symbolic parameters, do not use KEYWORDS, PARAMETERS or SUBPARAMETERS as symbolic names. Example: Do not use TIME=&TIME but yes you can use TIME=&TM and it is assumed as a right way of coding symbolics. User-defined symbolic parameters are called JCL Symbols. There are certain symbols called system symbols, which are used for logon job executions. The only system symbol used in batch jobs by normal users is &SYSUID and this is used in the NOTIFY parameter in the JOB statement.

10-12-2015

Page 7

Introduction to JCL - The EXEC Statement Cataloged Procedure When the procedure is separated out from the JCL and coded in a different data store, it is called a Cataloged Procedure. A PROC statement is not mandatory to be coded in a cataloged procedure. Remember, JCL code is normally stored as a member of a Partition Data Set or Library. A PDS is similar to a folder or subdirectory used in Windows or Linux, but a PDS cannot contain in another PDS, i.e., cannot be hierarchical. Load modules (compiled) or Procedures (JCL) are stored in Libraries. Libraries are simply another name for a PDS. Therefore, each compiled program is stored a member of a PDS or Library and each catalog procedure is also stored as a member. The following is an example of JCL where it's calling CATLPROC procedure:

Here, the procedure CATLPROC is cataloged in MYCOBOL.BASE.LIB1. PROG,DATAC and DSNAME are passed as symbolic parameters to the procedure CATLPROC.

Major Types of Catalog Procedures Since a catalog procedure is stored so that it can be reused by other users, the question is how do we find the catalog procedure to reuse it? If the catalog procedure is located in the same PDS, by the JCL member that is calling it, then there will be no problem. But, in order for all designated users to find the catalog procedure it would not be practical to have all users to copy the JCL procedures to their private PDS. We will shortly discuss JOBLIB and STEPLIB. These special DDNames will assist us to find catalog procedure and load module libraries outside the current PDS. For now, it is important designate several categories of catalog procedures.  



System Catalog Procedures - Anyone can find and use these catalog procedures without extra JCL code. User Shared Catalog Procedures - Some collection of users can find and use these catalog procedures with extra JCL code, e.g., JOBLIB and STEPLIB. Private User Catalog Procedures - Only a designated user can find and use these catalog procedures with extra JCL code, e.g., JOBLIB and STEPLIB.

10-12-2015

Page 8

Introduction to JCL - The EXEC Statement A Little Review Given the following JCL code for CBL0001J. (This code may be reviewed by using your RMUXXXX.JCL(CBL0001J) data set member where XXXX is your userID

Q.1 How may job steps are there in CBL0001J? Two job steps, because there are two EXEC statements. Q.2 What is the name of first job step (EXEC)? COBOL Q.3 What is the name of second job step (EXEC)? STEP2 Q.4 Can you rename the COBOL and STEP2 job steps? The step names are arbitrary to the system programmer. You can rename them as STEELERS and PIRATES, but this will confuse people who did not live in Pittsburgh. Better code job step that is more descriptive or professional. Q.5 The COBOL Job step is

Is IGYWCL PDS member which is a compiled and linked load module or a JCL Procedure? A JCL Procedure since the PGM= positional parameter is NOT coded.

10-12-2015

Page 9

Introduction to JCL - The EXEC Statement Q.6 The STEP2 job step is

Is CBL0001 a PDS member which is a compiled and linked load module or a JCL Procedure? It is a compiled and linked binary load module since the PGM= positional parameter IS coded. Actually, the contents of the load module looks like

The name of this JCL member is CBL0001J. Before the COBOL job step is executed, JES will insert the JCL code for IGYWCL JCL Procedure. If you review the expanded JCL code in =SD;ST after you have submitted the you will see the following SDSF JOB DATA SET DISPLAY JESJCL contains both the original CBL001J JCL code and the inserted IGYWCL JCL code. Type S under the NP column

Any line beginning with the //, e.g., Line 1, was the CBL001J JCL code. Any line beginning with XX is the inserted IGYWCL Procedure JCL code, e.g., Lines 3, 4, 5, etc.

10-12-2015

Page 10

Introduction to JCL - The EXEC Statement

Using JCL Variable Substitution Any code prefixed with and ampersand is called a substitution variable, e.g., &SYSUID. In Line 1, the NOTIFY=&SYSUID will substitute the userID who submitted the JCL job, which is NOTIFY=RMUI001 in this example. Your userid will be inserted when you submit the job.

In Line 15 the COBOL Compiler need to know the location of the COBOL source code. The DSN=&SYSUID.COBOL(CBL0001) now is substituted as DSN=RMUI001.COBOL(CBL0001)

10-12-2015

Page 11

Introduction to JCL - The EXEC Statement The PARM Parameter The PARM parameter passes information to the executing program. Some programs accept information from the PARM parameter about how many times to execute. For example, a program may need to know whether a report cycle is "annual" or "monthly". The records the program inputs (uses) may vary depending on which value is passed to it. Similarly, the PARM parameter can supply a password to the program that is required before the program executes. The syntax for the PARM parameter is: PARM=(SUBPARAMETER,SUBPARAMETER) The general syntax and rules for coding the PARM parameter are:    

The PARM parameter can include up to 100 characters The PARM parameter can consist of several subvalues separated by commas. Subparameters must be enclosed in parentheses or apostrophes Special characters must be enclosed in apostrophes This EXEC statement passes one value (MONTHLY) as input to a program named REPORT.

10-12-2015

Page 12

Introduction to JCL - The EXEC Statement This EXEC statement passes the date (10-31-15) as input to the program called REPORT. The subparameter is enclosed in apostrophes because special characters are used.

In this example, the EXEC statement passes both the type of report (MONTHLY) and the date (10-3115) as subparameters of the PARM parameter. The two subparameters are enclosed in parentheses. =3.Given the following two EXEC Statements.

It may seem more logical to have the system programmer to type in the parameters interactively. But, batch processing has no user interface. Therefore, the PARM parameter to enter data that would modify how a program would be executed without a user interface. For example, A COBOL program would use statements such as ACCEPT TYPE-OF-REPORT. IF TYPE-OF-REPORT = "MONTHLY" PERFORM MOTHLY-REPORT.

10-12-2015

Page 13

Introduction to JCL - The EXEC Statement The COND Parameter What does the COND parameter do? To provide control over the whole job, you can code the condition (COND) parameter on the JOB statement. You can also code it on the EXEC statement to control an individual step in the job. The syntax for the COND parameter is: COND=(code,operator) The COND Subparameters Subparameters are the values inside the parenthesis./ When you use the COND parameter on an EXEC statement, the parameter specifies the conditions that allow the system to bypass a step by testing return codes from any or all previous steps. If the result of any test is true, the system will bypass the step. As on the JOB statement, the code subparameter indicates a return code, and the operator subparameter indicates the type of test used for the comparison.

COND=(code,operator) or

COND=(code,operator,stepname) or

COND=(code,operator,stepname.procstepname) What happens if you specify only the code and operator subparameters? If you specify only the code and operator subparameters, the test runs for all previous return codes in the job. The stepname.procstepname subparameter (instead of the stepname subparameter) compares a code value against the return code from a specific previous procedure job step. The actual return code value, which may range from 0 to 4095, is compared with the return code specified in the COND parameter. When the COND parameter of the JOB statement was previously discussed, the most common conventional values were presented, e.g., 0 = Normal - all OK, 4 = Warning - minor errors or problems, 8 = Error - significant errors or problems, 12 = Severe error, and 16 = Terminal error.. However, the application programmer can code an ABEND statement with any value of a return code. Therefore, with 4,095 difference options, the COND parameter can be customized to meet any code. You can code up to eight comparisons. If any comparison is true, the system bypasses the step. The COND parameter test you when NOT to execute a step.

10-12-2015

Page 14

Introduction to JCL - The EXEC Statement COND Parameter – An Example

In the example shown here, the COND parameter reads as follows: "If the return code from any previous step is less than 8, then bypass this step (which is EXAMPLE3)."

The COND parameter in the step EXAMPLE3, includes a stepname subparameter. This causes the COND statement to read as follows: "If the return code from step EXAMPLE2 is less than 8, then bypass step EXAMPLE3."

The COND Subparameters – EVEN & ONLY In addition to code, operator, stepname, and procedure stepname, the EVEN and ONLY Subparameters may also be coded on the COND parameter. These subparameters do not apply to condition codes returned by a program after normal termination. They relate to abnormal termination of a prior step. Abnormal termination occurs when unexpected conditions arise during execution of a step. Without the use of EVEN or ONLY, a job bypasses all remaining steps fo...


Similar Free PDFs