zOS MVS JCL Introduction Copyright IBM Corp 2000
z/OS MVS JCL Introduction © Copyright IBM Corp. , 2000, 2004. All rights reserved.
z/OS MVS JCL Introduction UNIT Coding JOB Statements Topics: § The JOB Statement § The JOB Name § The JOB Parameter Field § Keyword Parameters § Complete JOB Statement § JOB Statement Parameters © Copyright IBM Corp. , 2000, 2004. All rights reserved. 2
z/OS MVS JCL Introduction Unit: Introduction to JCL Topic: Introduction Job Control Language What is JCL? Job Control Language (JCL) is a control language used to identify a job to an operating system and to describe the job’s requirements. It consists of a series of statements, each of which provides specific instructions or information for batch processing jobs. JCL is used to describe the work you want a system using multiple virtual storage (MVS) to perform. The three main types of JCL statements are: Concepts • JOB - It marks the beginning of a job and identifies the job name • EXEC - It marks the beginning of a job step and specifies the name of the program to be executed • DD - It describes data sets to be used within individual steps © Copyright IBM Corp. , 2000, 2004. All rights reserved. 3
z/OS MVS JCL Introduction Unit: Coding JOB Statements Unit Objectives At the end of this unit, you will be able to: • Explain the purpose and syntax of the JOB statement • Define the JOB name • Code positional parameters and keyword parameters • Code the most commonly used keyword parameters on a JOB statement • Complete the JOB statement • Code additional JOB statement parameters Introduction © Copyright IBM Corp. , 2000, 2004. All rights reserved. 4
z/OS MVS JCL Introduction Unit: Coding JOB Statements Topic: The JOB Statement Defining a JOB Statement A JOB statement is the first statement in any JCL code. It marks the start of a job and gives the name of the job. The parameters included in the JOB statement, such as accounting information and condition settings for job termination, apply to the entire job. Concepts © Copyright IBM Corp. , 2000, 2004. All rights reserved. 5
z/OS MVS JCL Introduction Unit: Coding JOB Statements Topic: The JOB Statement The JOB Name The JOB name is a 1 to 8 character name that identifies the job so that other JCL statements or the operating system can refer to it. //JOB 1 The JOB name must begin in position 3 with no spaces between it and the identifier. JOB Name Concepts JOB 776, M. FLURY © Copyright IBM Corp. , 2000, 2004. All rights reserved. 6
z/OS MVS JCL Introduction Unit: Coding JOB Statements Topic: The JOB Statement The Operation Field The operation field follows the job name. For a JOB statement, the operator in the operation field is JOB. //JOB 1 JOB 776, M. FLURY Operation Field Always separate the operation field and the job name by at least one space. Concepts © Copyright IBM Corp. , 2000, 2004. All rights reserved. 7
z/OS MVS JCL Introduction Unit: Coding JOb Statements Topic: The JOB Statement Parameter Fields The parameter field, in the JOB statement defines information that applies to the entire job. This information includes accounting information, programmer name, and additional information regarding the job. //JOB 1 JOB 504, SMITH Parameter Field One or more spaces separate the job parameters from the JOB operation field. The parameter field can specify job accounting information and the programmer's name as has been shown on the right. A comma separates the job accounting information and the programmer's name. Always use a comma to separate parameters in a JOB statement. Concepts © Copyright IBM Corp. , 2000, 2004. All rights reserved. 8
z/OS MVS JCL Introduction Unit: Coding JOB Statements Topic: The JOB Name Rules for Job Names: A Summary The rules for coding job names have been discussed in Unit 1, Topic 1 – JCL Statement Syntax. To summarize once again, these rules require a job name to begin in position 3 and to be 1 to 8 characters in length. The first character of a job name should be either alphabetic or a national symbol. It should not be a number. The rest of the characters in the job name can be either alphanumeric or they can be national symbols. Valid Job Names //JOB 1 JOB //EXAMPLE 4 JOB //RUN#2 JOB Invalid Job Names //JOB 1+ JOB (Includes a special character) //EXAMPLE 14 JOB (More than eight characters) // RUN#2 JOB (Does not begin in position 3) Special characters or spaces are not allowed. Concepts © Copyright IBM Corp. , 2000, 2004. All rights reserved. 9
z/OS MVS JCL Introduction Unit: Coding JOB Statements Topic: The JOB Parameter Field Positional Parameters The parameter field of a JOB statement appears after the JOB operator field. //JOB 1 JOB 776, K. YALE There are two types of parameters: • • //JOB 2 JOB CLASS=A Positional parameters Keyword parameters What are positional parameters? Positional Parameters Keyword Parameter Positional parameters are parameters that are characterized by their location in the parameter field in relation to other parameters. Positional parameters appear first in the parameter field in a fixed order if there are multiple parameters. Concepts © Copyright IBM Corp. , 2000, 2004. All rights reserved. 10
z/OS MVS JCL Introduction Unit: Coding JOB Statements Topic: The JOB Parameter Field Coding the Positional Parameter The two positional parameters for a JOB statement are: //JOBNUM 1 JOB 776, K. YALE • • Job accounting information Programmer name Always code these parameters in the order shown here and separate them by a comma. For example: The job statement shown here uses a job accounting number of 776 and identifies the programmer of this job as K. YALE. Concepts © Copyright IBM Corp. , 2000, 2004. All rights reserved. 11
z/OS MVS JCL Introduction Unit: Coding JOB Statements Topic: The JOB Parameter Field Job Accounting Information: Subparameters When job accounting information consists of multiple subparameters, the job accounting subparameters must be enclosed in either parenthesis or apostrophes. The job accounting information appear in parentheses here. //JOB 1 JOB (255, ’DEPT/OPS’), K. YALE Multiple Parameters Why? It appears in parentheses because it consists of two subparameters: • • 255 DEPT/OPS The parentheses indicate to the operating system that both subparameters comprise the job accounting information. Continued… Concepts © Copyright IBM Corp. , 2000, 2004. All rights reserved. 12
z/OS MVS JCL Introduction Unit: Coding JOB Statements Topic: The JOB Parameter Field Job Accounting Information: Subparameters (cont’d) Can you use special characters in subparameters? //JOB 1 JOB(255, ’DEPT/OPS’), K. YALE Special characters can be used in subparameters, provided the subparameters are enclosed in apostrophes. Special Character For example: The subparameter ‘DEPT/OPS’ shown is enclosed in apostrophes because the slash (/) is a special character. Concepts © Copyright IBM Corp. , 2000, 2004. All rights reserved. 13
z/OS MVS JCL Introduction Unit: Coding JOB Statements Topic: The JOB Parameter Field Omitting Job Accounting Parameter Job accounting information is the first positional parameter you can code on a JOB statement. If you omit the job accounting parameter, you must indicate its absence with a comma if you are coding the programmer name. //JOB 1 JOB , K. YALE //JOB 2 JOB 766, K. YALE If you decide to leave out both positional parameters, you do not have to include commas. For example: In the first JOB statement here, a comma replaces the job accounting information. The second JOB statement includes a job account number. Both JOB statements are valid. Concepts © Copyright IBM Corp. , 2000, 2004. All rights reserved. 14
z/OS MVS JCL Introduction Unit: Coding JOB Statements Topic: The JOB Parameter Field The Programmer Name The programmer name parameter identifies the person or group responsible for a job. If you decide to include this information, the programmer name must immediately follow the job accounting information parameter (or a comma to indicate its absence). Concepts //JOB 1 JOB 255, ’JOHN SMITH’ //JOB 2 JOB , YALE Programmer Name © Copyright IBM Corp. , 2000, 2004. All rights reserved. 15
z/OS MVS JCL Introduction Unit: Coding JOB Statements Topic: The JOB Parameter Field Coding Programmer Name The rules that apply to a programmer's name are as follows: • • Programmer Name Rules Separate the programmer's name from a preceding or following parameter by a comma Make sure the programmer's name does not exceed 20 characters 255, SMITH, MSGLEVEL=(1, 0) 255, LONGPROGRAMERNAME 255, ’JOHN SMITH’ • • Concepts Enclose the programmer's name in apostrophes when, the name contains special characters (other than periods or hyphens) 255, ’O”HARA’ Double any apostrophes in the programmer's name © Copyright IBM Corp. , 2000, 2004. All rights reserved. 16
z/OS MVS JCL Introduction Unit: Coding JOB Statements Topic: The JOB Parameter Field Coding Programmer Name – Example 1 If you want to code the programmer name JOHN SMITH in a JOB statement, you would do it as shown here. The name is enclosed in apostrophes because the name JOHN SMITH contains a space between the first name and the last name (a space is considered a special character). Concepts //JOB 1 JOB 766, ’JOHN SMITH’ Special Character © Copyright IBM Corp. , 2000, 2004. All rights reserved. 17
z/OS MVS JCL Introduction Unit: Coding JOB Statements Topic: The JOB Parameter Field Coding Programmer Name – Example 2 If the programmer name already contains an apostrophe, you must still use apostrophes, since the apostrophe in the programmer name is a special character. If you want to code the programmer name O'HARA in a JOB statement, you would do it as shown here. //JOB 1 JOB 766, ’O”HARA’ Name contains an apostrophe If you prefer to enclose the programmer name in apostrophes (for consistency), you may do so even if the name does not contain any special characters. You must use a quotation mark to represent a single apostrophe. MVS interprets the quotation mark as an apostrophe, not as a syntactic apostrophe delimiting a string. Concepts © Copyright IBM Corp. , 2000, 2004. All rights reserved. 18
z/OS MVS JCL Introduction Unit: Coding JOB Statements Topic: Keyword Parameters Defining Keyword Parameters Apart from positional parameters, the parameter may also contain keyword parameters. Keyword Parameters ADDRSPC REGION CLASS RD COND LINES GROUP RESTART MSGCLASS SECLABEL Keyword parameters supply information to the operating system for control of jobs. MSGLEVEL TIME CARDS TYPRUN The commonly used keyword parameters are: NOTIFY USER PASSWORD BYTES PERFORM PAGES PRTY SCHENV What are keyword parameters? Keyword parameters are parameters consisting of a keyword and equal sign and variable information. • • MSGLEVEL MSGCLASS CCSID Continued… Concepts © Copyright IBM Corp. , 2000, 2004. All rights reserved. 19
z/OS MVS JCL Introduction Unit: Coding JOB Statements Topic: Keyword Parameters Defining Keyword Parameters (cont’d) The characteristics of keyword parameters include : //JOB 1 JOB 255, SMITH, CLASS=A • Concepts They must follow any positional parameter Keyword • They can be coded in any order • They must include a keyword, an equal sign (=), and a value (for example, CLASS=A) Parameter © Copyright IBM Corp. , 2000, 2004. All rights reserved. 20
z/OS MVS JCL Introduction Unit: Coding JOB Statements Topic: Keyword Parameters The MSGLEVEL Parameter The MSGLEVEL parameter controls how the JCL, allocation messages, and termination messages are printed in the job's output listing (SYSOUT). You can request the following outputs using the MSGLEVEL parameter: Concepts • A listing of the JOB statement only • A listing of all user-supplied job control statements plus all inserted statements for procedures invoked by any of the job steps • Allocation, disposition, and termination messages © Copyright IBM Corp. , 2000, 2004. All rights reserved. 21
z/OS MVS JCL Introduction Unit: Coding JOB Statements Topic: Keyword Parameters Coding the MSGLEVEL Parameter The MSGLEVEL parameter includes two subparameters: • • Statements Messages //JOB 1 JOB 255, SMITH, MSGLEVEL=(0, 0) Statement Message The syntax for coding the MSGLEVEL parameter is: MSGLEVEL=(statements, messages) Multiple subparameters are enclosed in parentheses as has been shown here. Concepts © Copyright IBM Corp. , 2000, 2004. All rights reserved. 22
z/OS MVS JCL Introduction Unit: Coding JOB Statements Topic: Keyword Parameters The MSGLEVEL Parameter – Statement Subparameter What does the statement subparameter indicate? The statement subparameter indicates which job control statements the system is to print on the job log. A statement subparameter can have one of the three values: Concepts • 0 – Print only the JOB statement • 1 – Print all JCL statements and JES 2 or JES 3 control statements, including invoked procedure statements • 2 – Print only JCL statements and JES 2 and JES 3 control statements from the job stream © Copyright IBM Corp. , 2000, 2004. All rights reserved. 23
z/OS MVS JCL Introduction Unit: Coding JOB Statements Topic: Keyword Parameters The MSGLEVEL Parameter – Messages Subparameter What does the messages subparameter indicate? The messages subparameter indicates which messages the system is to print on the job log. A messages subparameter can have one of the three values: Concepts • 0 – Print only JCL messages. Print JES and operator messages only if the job terminates abnormally • 1 – Print allocation/termination messages © Copyright IBM Corp. , 2000, 2004. All rights reserved. 24
z/OS MVS JCL Introduction Unit: Coding JOB Statements Topic: Keyword Parameters The MSGCLASS Parameter You can use the MSGCLASS keyword parameter to assign an output class for your output listing (SYSOUT). Output classes are defined by the installation to designate unit record devices, such as printers. //JOB 1 JOB 255, MSGLEVEL=(1, 1), // MSGCLASS=A Each class is one character long and is designated by: • A letter (A-Z) or • A numeral (0 -9) For example: In order to assign class A as the output class for your listing, you would code the MSGCLASS parameter as shown here. Concepts © Copyright IBM Corp. , 2000, 2004. All rights reserved. 25
z/OS MVS JCL Introduction Unit: Coding JOB Statements Topic: Keyword Parameters Defaults for MSGLEVEL & MSGCLASS Both the MSGLEVEL and MSGCLASS parameters may have default settings, depending on your installation. Omitting one or both of the keyword parameters from the JOB statement, would make the operating system use these default settings. In this case, you would code these parameters only if you want to have a different message level or message class than the preset. //JOB 1 JOB 255, MSGCLASS=A Default: MSGLEVEL=(1, 1) //JOB 255, MSGLEVEL=(1, 1) Default: MSGCLASS=A The MSGLEVEL subparameters are universal but output class assignments and the default settings for both parameters depend on your installation. Concepts © Copyright IBM Corp. , 2000, 2004. All rights reserved. 26
z/OS MVS JCL Introduction Unit: Coding JOB Statements Topic: JOB Statement Parameters Topic Objectives At the end of this topic, you will be able to: • Identify some additional keyword parameters and explain their purpose • Code the additional parameters Introduction © Copyright IBM Corp. , 2000, 2004. All rights reserved. 27
z/OS MVS JCL Introduction Unit: Coding JOB Statements Topic: JOB Statement Parameters Keyword Parameters on JOB Statement There a host of other keyword parameters which you can use in your JOB statement. //JOB 1 JOB keyword You can use them to produce the exact results you want. COND Some of the most commonly used keyword parameters have been shown here. These parameters follow the same guidelines as the keyword parameters MSGLEVEL and MSGCLASS. ADDRSPC CLASS NOTIFY PRTY REGION TIME TYPRUN USER PASSWORD Concepts © Copyright IBM Corp. , 2000, 2004. All rights reserved. 28
z/OS MVS JCL Introduction Unit: Coding JOB Statements Topic: JOB Statement Parameters The Operator Subparameter A JCL programmer can specify many ways of how the COND parameter tests a return code. The operator subparameter specifies the comparison method. Each test in a COND subparameter specifies its own operator subparameter which is independent of operators in any other tests. The JCL programmer decides which operator subparameter(s) to use. Shown here are the various operators available. Concepts Operator Meaning GT Greater than GE Greater than or equal to EQ Equal to NE Not equal to LT Less than LE Less than or equal to © Copyright IBM Corp. , 2000, 2004. All rights reserved. 29
z/OS MVS JCL Introduction Unit: Coding JOB Statements Topic: JOB Statement Parameters Reading the COND Parameter: Example 1 //JOB 1 JOB 776, SMITH, COND=(12, LT) //STEP 1 EXEC PGM=PROGRAMA e d o //STEP 2 EXEC PGM=PROGRAMB C u et R rn Return Code < 12 Step 1 Step 2 This example helps you read the COND parameter in the JOB statement as: "If 12 is less than the return code, do not execute any more job steps. " The job executes the remaining job steps only if the return code is 1 through 12. If the return code is 13 or higher, the remaining steps will be bypassed. Concepts © Copyright IBM Corp. , 2000, 2004. All rights reserved. 30
z/OS MVS JCL Introduction Unit: Coding JOB Statements Topic: JOB Statement Parameters Reading the COND Parameter: Example 2 //JOB 2 JOB 776, SMITH, COND=(12, GT) //STEP 1 EXEC PGM=PROGRAMA e d o //STEP 2 EXEC PGM=PROGRAMB C u et R rn Return Code > 12 Step 1 Step 2 This example helps you to read the COND parameter in the JOB statement as: "If 12 is greater than the return code of any job step, do not execute any more job steps. " The job executes the remaining job steps only if the return code is 12 or greater. If the return code is 0 through 11, the remaining steps will be bypassed. Concepts © Copyright IBM Corp. , 2000, 2004. All rights reserved. 31
z/OS MVS JCL Introduction Unit: Coding JOB Statements Topic: JOB Statement Parameters Reading the COND Parameter: Example 3 //JOB 3 JOB 776, SMITH, // COND=((16, LT), (8, GT)) e d o //STEP 1 EXEC PGM=PROGRAMA //STEP 2 EXEC PGM=PROGRAMB n r tu C 8 < Return Code < 16 e R Step 1 Step 2 This example helps you to make multiple comparisons, which might be needed in some cases. Here you can read the COND parameters in the JOB statement as: "If 16 is less than the return code or if 8 is greater than the return code, do not execute any more job steps. “ The job executes subsequent job steps only if the return code is 8, 9, 10, 12, 13, 14, 15, or 16 for each previous job step. Concepts © Copyright IBM Corp. , 2000, 2004. All rights reserved. 32
z/OS MVS JCL Introduction Unit: Coding JOB Statements Topic: JOB Statement Parameters COND Parameter on EXEC and JOB Statements //JOB 3 JOB 776, SMITH, COND=(12, GT) //STEP 1 EXEC PGM=PROGRAMA, // e d o COND=(12, GT) //DD DD DSN=INPUT n r tu C Return Code > 12 e //STEP 2 EXEC PGM=PROGRAMB R Step 1 Step 2 You can include the COND parameter in either the EXEC statements or the JOB statements. COND parameters coded in the JOB statement are tested before any COND parameters coded in EXEC statements within the job. When coded in the EXEC statement, it is possible to test the return code of specific steps. In the JOB statement, tests apply to all steps in the JOB. Concepts © Copyright IBM Corp. , 2000, 2004. All rights reserved. 33
z/OS MVS JCL Introduction Unit: Coding JOB Statements Topic: JOB Statement Parameters The CLASS Parameter Jobs are site-specific. You can check with your operations department about the job classes that are available for your use. //JOB 1 JOB 504, SMITH, CLASS=A A good balance of job class assignments helps to make the most efficient use possible of the system. Concepts Job class © Copyright IBM Corp. , 2000, 2004. All rights reserved. 34
z/OS MVS JCL Introduction Unit: Coding JOB Statements Topic: JOB Statement Parameters The NOTIFY Parameter The NOTIFY parameter indicates the TSO/E user the system must notify upon job completion. If you use the NOTIFY parameter to specify your TSO/E user ID, the operating system automatically sends you a job completion message when your job ends. For example, to have the system send a message to JSMITH when the job EX completes, you would code the NOTIFY parameter on a JOB statement as: //EX Concepts JOB . . . , NOTIFY=JSMITH © Copyright IBM Corp. , 2000, 2004. All rights reserved. 35
z/OS MVS JCL Introduction Unit: Coding JOB Statements Topic: JOB Statement Parameters The PRTY Parameter The PRTY parameter specifies a job's priority for selection within its job class. Usually, this parameter is meant to designate one job for execution over others in a class. //JOB 1 JOB 504, SMITH, PRTY=3 PRTY Parameter The range of PRTY values is usually 0 through 15 for JES 2 and 0 through 14 for JES 3, with 0 having the lowest priority. When no priority has been specified, the system processes jobs within the same class in a first-in, first-out manner. For example: If you have to give a specific priority of 3 to a job (within its default class), you will code the PRTY parameter on a JOB statement as has been shown here. Concepts © Copyright IBM Corp. , 2000, 2004. All rights reserved. 36
z/OS MVS JCL Introduction Unit: Coding JOB Statements Topic: JOB Statement Parameters Coding CLASS and PRTY Parameters If you have to give a specific priority to a job within a specific class, you will code both the CLASS and the PRTY parameters on the JOB statement. //JOB 1 // JOB 504, SMITH, CLASS=T, PRTY=3 For example: The JOB statement shown here specifies that the job has to run in class T and it has been accorded a priority of 3. It is not significant in which order the CLASS and PRTY keyword parameters appear. Concepts © Copyright IBM Corp. , 2000, 2004. All rights reserved. 37
z/OS MVS JCL Introduction Unit: Coding JOB Statements Topic: JOB Statement Parameters The REGION Parameter The REGION parameter specifies the amount of storage space (in kilobytes or megabytes) that has to be allocated to a particular job. You can make use of this parameter to override the default region size set at your installation. Incase of a JOB statement, the region specified in the REGION parameter applies to all steps in a job and it overrides any REGION parameter coded on an EXEC statement. //EXEC JOB . . . , REGION=value. K. . . , REGION=value. M Kilobytes Megabytes Continued… Concepts © Copyright IBM Corp. , 2000, 2004. All rights reserved. 38
z/OS MVS JCL Introduction Unit: Coding JOB Statements Topic: JOB Statement Parameters The REGION Parameter (cont’d) Normally, when the REGION parameter makes a GETMAIN request or a dynamic request for more storage, it limits the amount of virtual storage available to a program. Different programs operate best at different region levels. Fir instance, in order to limit the virtual storage space of a job to 512 KB, you will need to code the REGION parameter on the JOB statement as: //EX JOB . . . , REGION=512 K In a similar manner, in order to limit a job's virtual storage space to 1024 KB bytes or 1 MB, you will need to code the REGION parameter as: //EX Concepts JOB REGION=512 K REGION=1 M . . . , REGION=1 M © Copyright IBM Corp. , 2000, 2004. All rights reserved. 39
z/OS MVS JCL Introduction Unit: Coding JOB Statements Topic: JOB Statement Parameters REGION and ADDRSPC Parameters When you use the REGION parameter in conjunction with ADDRSPC=REAL, REGION specifies the amount of real storage. For instance, to limit a job's real storage space to 512 KB, you code the REGION parameter, along with the ADDRSPC parameter on the JOB statement as: //EX // JOB . . . , REGION=512 K, ADDRSPC=REAL REGION=512 K ADDRSPC=REAL Concepts REGION=1 M © Copyright IBM Corp. , 2000, 2004. All rights reserved. 40
z/OS MVS JCL Introduction Topic: JOB Statement Parameters Unit: Coding JOB Statements The TIME Parameter The TIME parameter specifies a maximum amount of processor time available for the job. If the limit in the TIME parameter is reached, the job will terminate abnormally. The syntax for the TIME parameter is: //jobname JOB . . . , TIME=(minutes, seconds) The TIME parameter preserves processor time in case of an undetected error (like an endless loop) that may surface only during execution of program. For example, to limit the CPU execution time to 2 minutes and 45 seconds, you will need to code the TIME parameter on a JOB statement as: //EXAMPLE 1 Concepts JOB 776, STUDENT, TIME=(2, 45) © Copyright IBM Corp. , 2000, 2004. All rights reserved. 41
z/OS MVS JCL Introduction Unit: Coding JOB Statements Topic: JOB Statement Parameters The USER Parameter The USER parameter identifies the user ID of the person who submitted the job. This parameter uses a USERID subparameter which must be 1 to 7 alphanumeric characters or national symbols. The first character cannot be numeric. Many system facilities, including the Resource Access Control Facility (RACF) and the System Resource Manager (SRM) use the USERID subparameter. For example, in order to specify a user ID named HARRIS, you will have to code the USER parameter as: //EXAMPLE JOB 776, STUDENT, USER=HARRIS Whether the USER parameter is required by you or not, depends on the requirements of your site. In most cases, the USER parameter is used in conjunction with the PASSWORD parameter. Concepts © Copyright IBM Corp. , 2000, 2004. All rights reserved. 42
z/OS MVS JCL Introduction Unit: Coding JOB Statements Topic: JOB Statement Parameters Coding Multiple Keyword Parameters You can code multiple keyword parameters on a single JOB statement in any order that you choose after any positional parameters are coded. Here, the JOB 1 job is limited in processing time to 2 minutes, 45 seconds, and has been allocated a limited space of 768 KB. //JOB 1 // // JOB 504, SMITH, TIME=(2, 45), REGION=768 K, CLASS=T, PRTY=3, NOTIFY=JSMITH This job has a class of T, and a job priority of 3 within class T. This means that this job named JOB 1 will run ahead of all other jobs in class T that have a lower priority value (PRTY value) than 3. The operating system notifies user JSMITH, upon the complete execution of the job. Concepts © Copyright IBM Corp. , 2000, 2004. All rights reserved. 43
z/OS MVS JCL Introduction Unit: Coding JOB Statements Topic: JOB Statement Parameters Glossary Virtual Storage – Storage space that may be regarded as addressable main storage by the user of a computer system in which virtual addresses are mapped into real addresses. TSO/E – Time Sharing Option Extensions. In the MVS/ESA environment, TSO/E provides virtual storage constraint relief. RACF – Resource Access Control Facility. An IBM licensed program that provides for access control by identifying and verifying the users of the system, by authorizing access to protected resources, by logging the detected unauthorized attempts to enter the system, and by logging the detected accesses to protected resources. Glossary © Copyright IBM Corp. , 2000, 2004. All rights reserved. 44
z/OS MVS JCL Introduction UNIT Coding EXEC Statements Topics: § The EXEC Statement § The EXEC Parameter Field § Additional EXEC Parameters § The PARM Parameter § The COND Parameter § The System Library § The STEPLIB DD Statement © Copyright IBM Corp. , 2000, 2004. All rights reserved. 45
z/OS MVS JCL Introduction Unit: Coding EXEC Statements Unit Objectives At the end of this unit, you will be able to: • Code an EXEC statement to specify a program to be executed • Correct coding errors in an EXEC statement • Identify which JCL statement has caused a “PROGRAM NOT FOUND” error message • Identify the system library from which programs are retrieved at execution time • Identify the DD statement names used to specify a private library from which programs are retrieved at execution time • Select the place in the job stream where STEPLIB and JOBLIB DD statements should be located • Code a JOBLIB DD statement Introduction © Copyright IBM Corp. , 2000, 2004. All rights reserved. 46
z/OS MVS JCL Introduction Unit: Coding EXEC Statements Topic: The EXEC Statement To execute each program in a job, you need to code one EXEC statement. Each job step begins with an EXEC statement that identifies a program name. The EXEC statement is used to invoke the program that you want to execute as part of a job. In addition to this, you can also use the EXEC statement to invoke a cataloged procedure. What is a cataloged procedure? A cataloged procedure refers to a set of JCL statements that are stored in a library and retrieved by its name. Procedure A procedure may contain one or more EXEC statements. Continued… Concepts © Copyright IBM Corp. , 2000, 2004. All rights reserved. 47
z/OS MVS JCL Introduction Unit: Coding EXEC Statements Topic: The EXEC Statement (cont’d) Identifier Name Operation Parameter Comment In Unit 2 – 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: • • • 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 Continued… Concepts © Copyright IBM Corp. , 2000, 2004. All rights reserved. 48
z/OS MVS JCL Introduction Unit: Coding EXEC Statements Topic: The EXEC Statement (cont’d) Shown here is an example where the step name is STEP 1. 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 STEP 1. Operator //STEP 1 EXEC PGM=IEBUPDTE Step Name Positional Parameter The step name STEP 1 identifies the EXEC statement so that the subsequent JCL statements can refer to it. Code a step name on all your EXEC statements even if there might not be any references to those statements. Concepts © Copyright IBM Corp. , 2000, 2004. All rights reserved. 49
z/OS MVS JCL Introduction Unit: Coding EXEC Statements Topic: The EXEC Statement The Step Name 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 step name should be either alphabetic or a national symbol • The first character cannot be a number • Rest of the characters in the step name can either be alphanumeric or they can be national symbols • Special characters and spaces cannot be used in a step name Valid Step Names //STEP 1 EXEC //EXAMPLE 4 EXEC //RUN#2 EXEC Invalid Step Names //STEP 1+ EXEC (Includes a special character) //EXAMPLE 14 EXEC (More than eight characters) // RUN#2 EXEC (Does not begin in position 3) Continued… Concepts © Copyright IBM Corp. , 2000, 2004. All rights reserved. 50
z/OS MVS JCL Introduction Unit: Coding EXEC Statements Topic: The EXEC Statement The Step Name (cont’d) Shown here are two step names STEP#FOUR and LA$JOE. Are both the names valid step names? //STEP#FOUR EXEC PGM=IEFBR 14 //LA$JOE EXEC PGM=IEGENER 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. Concepts © Copyright IBM Corp. , 2000, 2004. All rights reserved. 51
z/OS MVS JCL Introduction Unit: Coding EXEC Statements Topic: The EXEC Statement Glossary Procedure Glossary – Prepared sets of job control statements cataloged in a procedure library © Copyright IBM Corp. , 2000, 2004. All rights reserved. 52
z/OS MVS JCL Introduction Unit: Coding EXEC Statements Topic: The EXEC Parameter Field 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=. Concepts //STEP 1 EXEC procedure-name //STEP 2 EXEC PROC=procedure //STEP 1 EXEC PGM=program-name Positional Parameter © Copyright IBM Corp. , 2000, 2004. All rights reserved. 53
z/OS MVS JCL Introduction Unit: Coding EXEC Statements Topic: The EXEC Parameter Field The PGM= Positional Parameter //JOB 1 JOB 3 SPO 3 W, CLASS=B //STEP 1 EXEC PGM=PAYROLL Program Payroll 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. Concepts © Copyright IBM Corp. , 2000, 2004. All rights reserved. 54
z/OS MVS JCL Introduction Unit: Coding EXEC Statements Topic: The EXEC Parameter Field The PROC= Positional Parameter //LA$JOE JOB //STEP 1 3 SPO 3 W, CLASS=B EXEC PROC=MYPROC Procedure What does PROC= designate? PROC= designates a procedure the system executes. The syntax of PROC as a positional parameter in an EXEC statement is shown here. Concepts © Copyright IBM Corp. , 2000, 2004. All rights reserved. 55
z/OS MVS JCL Introduction Unit: Coding EXEC Statements Topic: The EXEC Parameter Field Omitting the PROC= Keyword 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. //STEP 3 EXEC procedure-name //STEP 3 EXEC MYPROC For example, to call a procedure named MYPROC from a step named STEP 3, you will need to code the EXEC statement as shown on the right. Concepts © Copyright IBM Corp. , 2000, 2004. All rights reserved. 56
z/OS MVS JCL Introduction Unit: Coding EXEC Statements Topic: The EXEC Parameter Field Positional Parameter Coding Errors JCL errors occur if you, as a JCL programmer fail to follow any of the coding rules regarding the PGM and PROC positional parameters. //LA$JOE JOB //STEP 1 3 SPO 3 W, CLASS=B EXEC PGR=IEFBR 14 For example, the misspelling of PGM (as PGR) in the EXEC statement shown here returns a JCL error. Continued… Concepts © Copyright IBM Corp. , 2000, 2004. All rights reserved. 57
z/OS MVS JCL Introduction Unit: Coding EXEC Statements Topic: Additional EXEC Parameters Procedures In addition to programs, you can use the EXEC statement to invoke a cataloged procedure, which is a set of JCL statements that you place in a library and retrieve by its name. A procedure can contain one or more EXEC statements, with associated DD statements. Concepts © Copyright IBM Corp. , 2000, 2004. All rights reserved. 58
z/OS MVS JCL Introduction Unit: Coding EXEC Statements Topic: Additional EXEC Parameters Keyword Parameters You may code keyword parameters on the EXEC statement in any order, following the program or procedure name being executed. You can use any of the keyword parameters shown here on the EXEC statement. If you code one of these keyword parameters on the EXEC statement, the keyword parameter value will apply only to that step. The two keyword parameters used most frequently with the EXEC statement are: PGM=PROGA, keyword ACCT RD DYNAMNBR ADDRSPC PERFORM REGION PARM COND • • The PARM parameter The COND parameter TIME DPRTY CCSID Concepts © Copyright IBM Corp. , 2000, 2004. All rights reserved. 59
z/OS MVS JCL Introduction Unit: Coding EXEC Statements Topic: The PARM Parameter What does the PARM parameter do? 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 uses 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) Concepts © Copyright IBM Corp. , 2000, 2004. All rights reserved. 60
z/OS MVS JCL Introduction Unit: Coding EXEC Statements Topic: The PARM Parameter Rules for Coding the PARM Parameter The general syntax and rules for coding the PARM parameter are: Concepts • 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 © Copyright IBM Corp. , 2000, 2004. All rights reserved. 61
z/OS MVS JCL Introduction Unit: Coding EXEC Statements Topic: The PARM Parameter Coding the PARM Parameter – Example 1 //JOB 1 JOB 766, SMITH PARM=MONTHLY //RUN#2 EXEC PGM=REPORT, // PARM=MONTHLY PARM Parameter REPORT This EXEC statement passes one value (MONTHLY) as input to a program named REPORT. Concepts © Copyright IBM Corp. , 2000, 2004. All rights reserved. 62
z/OS MVS JCL Introduction Unit: Coding EXEC Statements Topic: The PARM Parameter Coding the PARM Parameter – Example 2 //JOB 1 JOB 766, SMITH PARM=’ 10 -31 -98’ //RUN#2 EXEC PGM=REPORT, // PARM=’ 10 -31 -98’ PARM Parameter REPORT This EXEC statement passes the date (10 -31 -98) as input to the program called REPORT. The subparameter is enclosed in apostrophes because special characters are used. Concepts © Copyright IBM Corp. , 2000, 2004. All rights reserved. 63
z/OS MVS JCL Introduction Unit: Coding EXEC Statements Topic: The PARM Parameter Coding the PARM Parameter – Example 3 //JOB 1 JOB 766, SMITH PARM=(MONTHLY, ’ 10 -31 -98’) //RUN#2 EXEC PGM=REPORT, // PARM=(MONTHLY, ’ 10 -31 -98’) PARM Parameter REPORT In this example, the EXEC statement passes both the type of report (MONTHLY) and the date (10 -31 -98) as subparameters of the PARM parameter. The two subparameters are enclosed in parentheses. Concepts © Copyright IBM Corp. , 2000, 2004. All rights reserved. 64
z/OS MVS JCL Introduction Unit: Coding EXEC Statements Topic: The COND Parameter Topic Objectives At the end of this topic, you will be able to: • Explain the purpose of the COND parameter in an EXEC statement • Code the COND parameter and the various COND subparameters in an EXEC statement Introduction © Copyright IBM Corp. , 2000, 2004. All rights reserved. 65
z/OS MVS JCL Introduction Unit: Coding EXEC Statements Topic: 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) 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. Concepts © Copyright IBM Corp. , 2000, 2004. All rights reserved. 66
z/OS MVS JCL Introduction Unit: Coding EXEC Statements Topic: The COND Parameter Operators Like the JOB statement COND parameter, each test in an EXEC statement COND parameter has its own operator. This operator is independent of any other operators in any other tests. Concepts Operator Meaning GT Greater than GE Greater than or equal to EQ Equal to NE Not equal to LT Less than LE Less than or equal to © Copyright IBM Corp. , 2000, 2004. All rights reserved. 67
z/OS MVS JCL Introduction Unit: Coding EXEC Statements Topic: The COND Parameter – An Example COND=(8, GT) //JOB 1 JOB 778, SMITH //EXAMPLE 2 EXEC PGM=DELETE //EXAMPLE 3 EXEC PGM=UPDATE, // COND=(8, GT) //DD 1 DD DSN=INPUT DELETE 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. " Continued… Concepts © Copyright IBM Corp. , 2000, 2004. All rights reserved. 68
z/OS MVS JCL Introduction Unit: Coding EXEC Statements Topic: The COND Parameter – An Example (cont’d) //JOB 1 JOB COND=(8, GT, STEP 1) 778, SMITH //EXAMPLE 2 EXEC PGM=DELETE //EXAMPLE 3 EXEC PGM=UPDATE, // COND=(8, GT, EXAMPLE 2) //DD 1 DD DSN=INPUT DELETE The COND parameter in the step EXAMPLE 3, includes a stepname subparameter. This causes the COND statement to read as follows: "If the return code from step EXAMPLE 2 is less than 8, then bypass step EXAMPLE 3. " Concepts © Copyright IBM Corp. , 2000, 2004. All rights reserved. 69
z/OS MVS JCL Introduction Unit: Coding EXEC Statements Topic: The COND Parameter EVEN Subparameter – An Example //JOB 1 JOB 778, SMITH //EXAMPLE 1 EXEC PGM=STEP 1 //EXAMPLE 2 EXEC PGM=STEP 2 //EXAMPLE 3 EXEC PGM=STEP 3 //EXAMPLE 4 EXEC PGM=STEP 4, // COND=EVEN //DD 1 DD DSN=INPUT If you code COND=EVEN on an EXEC statement as shown here, the program STEP 4 always executes, even if a previous step (e. g. STEP 3) in the job terminates abnormally. Concepts © Copyright IBM Corp. , 2000, 2004. All rights reserved. 70
z/OS MVS JCL Introduction Unit: Coding EXEC Statements Topic: The COND Parameter ONLY Subparameter – An Example //JOB 1 JOB 778, SMITH //EXAMPLE 1 EXEC PGM=STEP 1 //EXAMPLE 2 EXEC PGM=STEP 2 //EXAMPLE 3 EXEC PGM=STEP 3 //EXAMPLE 4 EXEC PGM=STEP 4, // COND=ONLY //DD 1 DD DSN=INPUT If you code COND=ONLY on an EXEC statement as shown here, the program STEP 4 will execute only if a previous step in the job terminates abnormally. Concepts © Copyright IBM Corp. , 2000, 2004. All rights reserved. 71
z/OS MVS JCL Introduction Unit: Coding EXEC Statements Topic: The COND Parameter Using the EVEN & ONLY Subparameters The EVEN and ONLY subparameters cannot appear on the same step. They are mutually exclusive. //ST 4 EXEC PGM=PROG 7, // However, EVEN or ONLY can be coded in place of one of the eight return code test allowed for each step. The order in which tests are coded does not matter. COND=((10, EQ, STEP 5), EVEN) //ST 4 EXEC PGM=PROG 7, // COND=(EVEN, (10, EQ, STEP 5)) For example, the two EXEC statements shown here mean the same thing. If a job step terminates abnormally, the system bypasses all subsequent steps unless they have been coded with an EVEN or ONLY subparameters on the COND parameter. Concepts © Copyright IBM Corp. , 2000, 2004. All rights reserved. 72
z/OS MVS JCL Introduction Unit: Coding EXEC Statements Topic: The System Library Private Program Libraries You can use private libraries to store programs. If you want to invoke a program called MYPROG which is stored in a private library, you must tell the operating system the name of the private library by coding a special DD statement named JOBLIB. //JOB 1 JOB //JOBLIB DD // 776, SMITH DSN=LIBRARY, DISP=SHR //STEP 1 EXEC PGM=MYPROG The JOBLIB DD statement causes the system to search a private library before searching SYS 1. LINKLIB. If you want the system to call a program from a private library you should insert the JOBLIB DD statement in the job before the first EXEC statement in the job. Concepts © Copyright IBM Corp. , 2000, 2004. All rights reserved. 73
z/OS MVS JCL Introduction Unit: Coding EXEC Statements Topic: The STEPLIB DD Statement Topic Objectives At the end of this topic, you will be able to: • Define the purpose of the STEPLIB DD statement • Distinguish between the JOBLIB and STEPLIB DD statements • Code a STEPLIB statement on a job Introduction © Copyright IBM Corp. , 2000, 2004. All rights reserved. 74
z/OS MVS JCL Introduction Unit: Coding EXEC Statements Topic: The STEPLIB DD Statement If most of the programs for a job reside in SYS 1. LINKLIB or LINKLIST and only a few are in private libraries, it makes more sense to direct the system to search a private library on a step-by-step basis. //STEP 1 EXEC PGM=PROGA //STEPLIB DD DSN=MYLIB, DISP=SHR This saves processing time by eliminating unnecessary searching. To search a private library directly you use a special DD statement called STEPLIB DD statement as shown. The STEPLIB DD statement can be placed anywhere in a job step but it typically appears after an EXEC statement. Concepts © Copyright IBM Corp. , 2000, 2004. All rights reserved. 75
z/OS MVS JCL Introduction Unit: Coding EXEC Statements Topic: The STEPLIB DD Statement Comparison between JOBLIB and STEPLIB DD Statements Just like a JOBLIB DD statement, the STEPLIB DD statement searches a private library for a specified program. But, the STEPLIB DD statement is in effect only for the duration of the step it follows. //JOB 1 JOB 777, SMITH //STEP 1 EXEC PGM=PROGA //STEP 2 EXEC PGM=MYPROG //STEPLIB DD // DISP=SHR //STEP 3 EXEC PGM=PROGB DSN=LIBRARY, Continued… Concepts © Copyright IBM Corp. , 2000, 2004. All rights reserved. 76
z/OS MVS JCL Introduction Unit: Coding EXEC Statements Topic: The STEPLIB DD Statement Comparison between JOBLIB and STEPLIB DD Statements (cont’d) What if a STEPLIB and JOBLIB DD statement both appear in a job? In this case the STEPLIB DD statement overrides the JOBLIB statement. The system ignores JOBLIB and it does not search it in the step. It starts search only with the step library. //JOB 1 JOB 777, SMITH //JOBLIB DD DSN=USER 1 //STEP 1 EXEC PGM=MYPROG //STEPLIB DD // DISP=SHR DSN=LIBRARY, If the system does not find the program in library specified by the STEPLIB DD statement, it searches the system libraries (SYS 1 LINKLIB and LINKLIST) next. If it does not find the program there, the job step terminates abnormally. Concepts © Copyright IBM Corp. , 2000, 2004. All rights reserved. 77
z/OS MVS JCL Introduction Unit: Conditional Processing Topic: IF/THEN/ELSE/ENDIF Construct Topic Objectives At the end of this topic, you will be able to: • Identify the various types of job conditions that an IF/THEN/ELSE/ENDIF statement construct can test • Code IF/THEN/ELSE/ENDIF statement constructs • Correct invalid IF/THEN, ELSE, and ENDIF JCL statements • State reasons why IF/THEN/ELSE/ENDIF JCL errors occur Introduction © Copyright IBM Corp. , 2000, 2004. All rights reserved. 78
z/OS MVS JCL Introduction Unit: Conditional Processing Topic: IF/THEN/ELSE/ENDIF Construct Syntax for the IF/THEN/ELSE/ENDIF Statement Construct What is the syntax for an IF/THEN/ELSE/ENDIF statement construct? The syntax for coding an IF/THEN/ELSE/ENDIF statement construct is: //name //name IF (relational-expression) THEN JCL statement(s) to be executed when relational-expression is true ELSE JCL statement(s) to be executed when relational-expression is false ENDIF The IF/THEN/ELSE/ENDIF statement construct can be coded anywhere in the job after the JOB statement. The name field in the IF/THEN/ELSE/ENDIF statement construct is optional but if specified it must follow the coding rules for names in JCL statements. Concepts © Copyright IBM Corp. , 2000, 2004. All rights reserved. 79
z/OS MVS JCL Introduction Unit: Conditional Processing Topic: IF/THEN/ELSE/ENDIF Construct The Name Field What are the rules for valid name fields? Even though the name field is optional, if one is coded then it must follow the normal coding rules for names in JCL statements, such as: Concepts Valid JCL Names //CHECK 1 IF (relational-expression) THEN //UNIQUE IF (relational-expression) THEN • The name must begin in position 3. If you do not code a name then leave the position blank • The name must be unique within the job • The first character of the name has to be alphabetical or national and it cannot be a number // CHECK 1 • The remaining characters can be alphanumeric or national //CHECK#2 IF • The name field must be followed by at least one space //PROG#1 IF (relational-expression) THEN Invalid JCL Names (Does not begin in position 3) //TOOMANYCHARS (More than eight characters) (Needs blank space after name) © Copyright IBM Corp. , 2000, 2004. All rights reserved. 80
z/OS MVS JCL Introduction Unit: Conditional Processing Topic: IF/THEN/ELSE/ENDIF Construct The Operation Field – The IF Statement Identifier Name Operation Relational-Expression Field Comment Identifier // UNIQUE NAME IF RELATIONAL-EXPRESSION THEN Field COMMENT . . . JCL statement to be executed when the expression is TRUE What is the Operation Field? The operation field contains the operators IF, ELSE, or ENDIF. What are the characteristics of the IF statement? The IF statement always precedes a relational-expression and the identifier THEN. Following the IF statement are all of the JCL statements to be executed when the relational-expression is true. If there are none, then the IF statement should be followed immediately by the ELSE statement. Concepts © Copyright IBM Corp. , 2000, 2004. All rights reserved. 81
z/OS MVS JCL Introduction Topic: IF/THEN/ELSE/ENDIF Construct Unit: Conditional Processing The Operation Field – The ELSE Statement Identifier Name Operation Comment Field // UNIQUE NAME ELSE COMMENT . . . JCL statement to be executed when the expression is FALSE What are the characteristics of the ELSE statement? Following the ELSE statement are all the JCL statements to be executed when the relational-expression is false. If there are none, then the ELSE statement can be omitted. The ELSE statement has no parameters. Anything following the ELSE operator is considered a comment. Concepts © Copyright IBM Corp. , 2000, 2004. All rights reserved. 82
z/OS MVS JCL Introduction Unit: Conditional Processing Topic: IF/THEN/ELSE/ENDIF Construct The Operation Field – The ENDIF Statement Identifier Name Operation Comment Field // UNIQUE NAME ENDIF COMMENT What are the characteristics of the ENDIF statement? The required ENDIF statement signifies the end of the IF/THEN/ELSE/ENDIF statement construct. There must be at least one EXEC statement following either the IF statement or the ELSE statement. Anything coded after the ENDIF statement is considered a comment by the operating system. Concepts © Copyright IBM Corp. , 2000, 2004. All rights reserved. 83
z/OS MVS JCL Introduction Unit: Conditional Processing Topic: IF/THEN/ELSE/ENDIF Construct The Relational-Expression Field What is the relational-expression field? The relational-expression field follows the IF statement and specifies the condition that is evaluated at execution. //TESTRC IF RC<8 THEN Relational-Expression Field Depending on the values in the expression, the result of the condition is either true or false. //TESTRC IF (RC<8) THEN In the example, the first statement tests for a return code of less than eight. Hence the relational-expression is RC<8. Also the relational-expression can be enclosed in parentheses, as shown in second statement. There must be at least one space between the IF operator and relational-expression field and similarly one space between the expression and the THEN operator. Concepts Continued… © Copyright IBM Corp. , 2000, 2004. All rights reserved. 84
z/OS MVS JCL Introduction Unit: Conditional Processing Topic: IF/THEN/ELSE/ENDIF Construct The Relational-Expression Field (cont’d) Relational-expressions can be continued on more than one line. To continue the expression, break the expression on a valid blank space and continue on the next line using columns 4 through 16. //TESTRC IF (ABEND | RC<8 | // RC=16) THEN Comment goes here Comments cannot be placed on the line you are continuing as the system will try to evaluate the comments as part of the expression. Concepts Continued… © Copyright IBM Corp. , 2000, 2004. All rights reserved. 85
z/OS MVS JCL Introduction Unit: Conditional Processing Topic: IF/THEN/ELSE/ENDIF Construct Comparison Operators What are the characteristics of a Comparison Operator? Comparison operators compare a relationalexpression keyword to a numeric value. The result of the comparison is either true or false. The comparison operators are either alphabetic or arithmetic. Concepts Operator Meaning GT or > Greater than GE or >= Greater than or equal to NG or ¬> Not greater than EQ or = Equal to NE or ¬= Not equal to LT or < Less than LE or <= Less than or equal to NL or ¬< Not less than © Copyright IBM Corp. , 2000, 2004. All rights reserved. 86
z/OS MVS JCL Introduction Unit: Conditional Processing Topic: IF/THEN/ELSE/ENDIF Construct Comparison Operators – An Example In this example, the statement tests if a return code is equal to 8. The relational-expression (RC=8) must be both preceded and followed by at least one space. No spaces are required before or after an arithmetic operator, such as = or >. At least one space is required both before and after alphabetic comparison operators, such as EQ or GT. //TESTIT IF (RC=8) THEN Spaces are not required //TESTIT IF RC EQ 8 THEN Spaces are required The use of parentheses in the relationalexpression is optional, but it is useful when coding combinations of expressions. Concepts © Copyright IBM Corp. , 2000, 2004. All rights reserved. 87
z/OS MVS JCL Introduction Unit: Conditional Processing Topic: IF/THEN/ELSE/ENDIF Construct Logical Operators- AND What are the characteristics of the AND operator? The AND (&) operator returns a value only if both relational-expressions are true. IF (RC>=8 & RC<=24) THEN RC = 12 For example, to test if a return code is between 8 and 24: The condition is true //TEST 1 IF (RC>8 & RC<24) THEN The AND operator must be preceded and followed by at least one space. Concepts © Copyright IBM Corp. , 2000, 2004. All rights reserved. 88
z/OS MVS JCL Introduction Unit: Conditional Processing Topic: IF/THEN/ELSE/ENDIF Construct Logical Operators- OR What are the characteristics of the OR operator? The OR (|) operator returns a true value if either of the relational-expression is true. IF (RC>8 | RC<16) THEN RC = 12 For example, to test if a return code is either equal to 8 or 16: The condition is false //TEST 2 IF (RC>8 | RC<16) THEN The OR operator must be preceded and followed by at least one space. Concepts © Copyright IBM Corp. , 2000, 2004. All rights reserved. 89
z/OS MVS JCL Introduction Unit: Conditional Processing Topic: IF/THEN/ELSE/ENDIF Construct Logical Operators- NOT What are the characteristics of the NOT operator? IF ¬(RC>12) THEN The NOT (¬) operator reverses the testing of a relational-expression. The system evaluates the NOT operator before any comparisons or logical operators. RC = 8 The condition is true For example, to test if a return code is not equal to 12: //TEST 3 IF ¬(RC=12) THEN The NOT operator does not require a space to separate it from the expression it is reversing. Concepts © Copyright IBM Corp. , 2000, 2004. All rights reserved. 90
z/OS MVS JCL Introduction Unit: Conditional Processing Topic: IF/THEN/ELSE/ENDIF Construct Relational-Expression Keywords What are the characteristics of relational-expression keywords? Relational-expression keywords are used to test a return code, abend condition or abend completion code, or to test if a step began executing. The relational-expression keywords are: • RC • ABEND • ¬ ABEND • ABENDCC • RUN • ¬RUN Preceding the keyword with a step name relates the expression to a specific job step. Syntax: stepname. keyword Preceding the keyword with both a step name and procedure step name relates the expression to a specific procedure step. Syntax: stepname. procstepname. keyword Concepts © Copyright IBM Corp. , 2000, 2004. All rights reserved. 91
z/OS MVS JCL Introduction Unit: Conditional Processing Topic: IF/THEN/ELSE/ENDIF Construct Relational-Expression Keywords - RC What are the characteristics of the RC keyword? RC represents the highest return code received from a previous job step. //TESTRC IF (RC>4) THEN //TESTRC IF (COMPILE. RC>4) THEN //TESTRC IF COMPILE. PROG 1. RC>4 THEN In the example, the first statement checks if the previous job step had a return code greater than 4. The second statement tests if a prior job step named COMPILE produced a return code greater than 4. The third one checks if a specific procedure, PROG 1 in the job step COMPILE, produced a return code greater than 4. Concepts © Copyright IBM Corp. , 2000, 2004. All rights reserved. 92
z/OS MVS JCL Introduction Unit: Conditional Processing Topic: IF/THEN/ELSE/ENDIF Construct Relational-Expression Keywords - ABEND What are the characteristics of the ABEND keyword? The keyword ABEND tests for abnormal termination from any previous job step. The syntax used for ABEND is: //TEST IF ABEND THEN //TEST IF TEST 1. ABEND = TRUE THEN //name IF ABEND THEN Or //name IF ABEND = TRUE THEN Both these statements will test for an abnormal termination in any of the previous steps. Both formats can be preceded with a step name or procedure step name to check specific job steps or procedure steps for abnormal termination. Concepts © Copyright IBM Corp. , 2000, 2004. All rights reserved. 93
z/OS MVS JCL Introduction Unit: Conditional Processing Topic: IF/THEN/ELSE/ENDIF Construct Relational-Expression Keywords - ABENDCC = Sxxx ABENDCC = Uxxxx U = Abnormal userdefined completion code S = Abnormal system completion code What are the characteristics of the ABENDCC keyword? The relational-expression keyword ABENDCC tests for a specific system abend completion code or user defined abend completion code from any previous job step. Both formats can be preceded with a step name or procedure step name to test the abend code from specific job steps or procedure steps. Concepts © Copyright IBM Corp. , 2000, 2004. All rights reserved. 94
z/OS MVS JCL Introduction Unit: Conditional Processing Topic: IF/THEN/ELSE/ENDIF Construct ABENDCC – An Example The first statement tests for an abnormal system completion code of 0 C 1 in the previous job step. The second statement tests for an abnormal user-defined completion code of U 0100 in a prior job step named RUNPGM in the previous job step. Concepts //TST 4 ABND IF ABENDCC = S 0 C 1 THEN //TST 4 ABND IF RUNPGM. ABENDCC = // U 0100 THEN © Copyright IBM Corp. , 2000, 2004. All rights reserved. 95
z/OS MVS JCL Introduction Unit: Conditional Processing Topic: IF/THEN/ELSE/ENDIF Construct The ELSE Clause – An Example To illustrate the working of the ELSE clause consider the following JCL code: //TESTRUN //GOOD // ELSE //ERROR // ENDIF //STEP 2 IF STEP 1. RUN THEN EXEC PGM=CREATE EXEC PGM=DELFILES EXEC PGM=COMPRESS The THEN clause contains one JCL statement named GOOD. The Program CREATE, specified in the GOOD EXEC statement, will not be executed unless STEP 1 has been executed successfully. If STEP 1 failed to execute, then a program DELFILES (specified in the statement named ERROR) will be executed as it is contained under the ELSE clause. Irrespective of whether STEP 1 was executed successfully or not, the program COMPRESS specified in STEP 2 will run as if it is not part of the IF/THEN/ELSE/ENDIF statement construct. Concepts © Copyright IBM Corp. , 2000, 2004. All rights reserved. 96
z/OS MVS JCL Introduction Unit: Conditional Processing Topic: Nesting Conditional Constructs In a nested conditional construct the THEN clause or the ELSE clause (or both) will contain an additional IF/THEN/ELSE/ENDIF construct. Each additional construct will have its own corresponding IF/THEN, ELSE and ENDIF statements. The IF/THEN/ELSE/ENDIF statement construct can be nested up to 15 levels. //COMPPGM //CHKCOMP //LNKPGM //CHKLKED //DELPGM // ELSE //RUNPGM // ENDIF //COMPLIB EXEC PGM=COMPILE IF (COMPPGM. RC<=4) THEN EXEC PGM=LINK IF (LNKPGM. RC>4) THEN EXEC PGM=DELETE EXEC PGM=MYPROG EXEC PGM=COMPRESS The example shows a nested conditional construct where the value of return code of a program determines the next step. Concepts © Copyright IBM Corp. , 2000, 2004. All rights reserved. 97
z/OS MVS JCL Introduction Unit: Using Special DD Statements Unit Introduction This unit describes the purpose, function and the format of certain special DD statements like backward references. This unit also describes DD statements that can be used to concatenate data sets and identify dummy data sets. DD statements that request storage dumps are also discussed in this unit. Introduction © Copyright IBM Corp. , 2000, 2004. All rights reserved. 98
z/OS MVS JCL Introduction Unit: Using Special DD Statements Unit Objectives At the end of this unit, you will be able to: • Code a DD statement to use information from preceding JCL statements • Identify the purpose of data set concatenation • Code JCL to concatenate a data set • Code a DD statement to indicate that a data set is to be ignored for the current program execution • Identify the purpose of special ddnames Introduction © Copyright IBM Corp. , 2000, 2004. All rights reserved. 99
z/OS MVS JCL Introduction Unit: Using Special DD Statements Topic: Using Backward Reference What is Backward Reference? A typical JCL job step may use or create a number of data sets, each requiring a variety of parameter values. Backward reference is a coding technique that directs the system to copy parameter values from preceding DD statements within the current job. DD PARAMETERS PGM VOL DSN DCB How does this technique help? Backward reference technique is more efficient as it saves the programmer from repetitive coding of information. Concepts © Copyright IBM Corp. , 2000, 2004. All rights reserved. 100
z/OS MVS JCL Introduction Unit: Using Special DD Statements Topic: Using Backward Reference Types of Backward References Four common backward references are: Concepts • PGM Reference: Points to a previous data set to specify a program name • DSN Reference: Points to a previous data set name • VOL Reference: Points to a previous volume serial number • DCB Reference: Points to DCB attributes defined in another previous DD statement © Copyright IBM Corp. , 2000, 2004. All rights reserved. 101
z/OS MVS JCL Introduction Unit: Using Special DD Statements Topic: Using Backward Reference Syntax for Backward Reference The general form of a backward reference is as follows: keyword=*. ddname • • To refer back to a prior DD statement within the same job step: • keyword=*. stepname. ddname Keyword=*. ddname //JOB 1 To refer back to a DD statement in a prior job step: //STEP 1 EXEC Keyword=*. stepname. ddname To refer back to a DD statement contained in a cataloged procedure called by a previous step: or //DD 1 //DD 2 //DD 3 DD DSN=ABC DD DSN=. . . DD DSN=*. DD 1 Keyword=*. stepname. procstep. ddname The keyword in each statement is either PGM, DSN, VOL or DCB. Concepts © Copyright IBM Corp. , 2000, 2004. All rights reserved. 102
z/OS MVS JCL Introduction Unit: Using Special DD Statements Topic: Using Backward Reference Syntax for PGM Backward Reference The general form of a PGM backward reference is as follows: //STEP Concepts EXEC PGM=*. stepname. ddname © Copyright IBM Corp. , 2000, 2004. All rights reserved. 103
z/OS MVS JCL Introduction Unit: Using Special DD Statements Topic: Using Backward Reference PGM Backward Reference – Example 1 A PGM backward reference is often used following a linkage edit step, in which a load module (program) is stored in a temporary data set. PGM backward reference is used in coding a later step that executes the program. The reference specifies the data set containing the program from the previous step. Concepts © Copyright IBM Corp. , 2000, 2004. All rights reserved. 104
z/OS MVS JCL Introduction Unit: Using Special DD Statements Topic: Using Backward Reference PGM Backward Reference – Example 2 In the example shown, the LINKEDIT program instructs the system to place a load module in a temporary library. The ddname is SYSLMOD and the data name is &&GOSET(GO). The DISP parameter specifies that the data is NEW and is to be PASSed to another step. //LKED EXEC PGM=LINKEDIT //SYSLMOD DD DSN=&&GOSET(GO), // DISP=(NEW, PASS), // UNIT=SYSDA, SPACE=(1024, (200, 20, 1)) //STEPA EXEC PGM=*. LKED. SYSLMOD STEPA executes the program, using a PGM backward reference. Concepts © Copyright IBM Corp. , 2000, 2004. All rights reserved. 105
z/OS MVS JCL Introduction Unit: Using Special DD Statements Topic: Using Backward Reference DSN Backward Reference – An Example Consider a payroll job consisting of several steps, all referring to the same data set. The job needs to be executed each week using a data set that contains the week’s transactions. This requires that, each week the data set name must be changed in the order WEEK 1, WEEK 2 and so on. //STEP 1 EXEC PGM=PROG 1 //DD 1 DD UNIT=SYSDA, // VOL=SER=PACK 12. SPACE=(800, (200, 2)), // DISP=(NEW, PASS), DSN=WEEK 1 //STEP 2 EXEC PGM=PROG 2 //DD 2 DD DSN=*. STEP 1. DD 1. DISP=(OLD, KEEP) By using a DSN backward reference, the data set can be retrieved each week by changing only one DD statement, DD 1. Continued… Concepts © Copyright IBM Corp. , 2000, 2004. All rights reserved. 106
z/OS MVS JCL Introduction Unit: Using Special DD Statements Topic: Using Backward Reference VOL Backward Reference – Example 1 Consider an example where PROGA creates and catalogs a data set named XYZ is to reside on the same volume as an existing, previously catalogued data set named ABC. To refer the system to data set ABC, a VOL backward reference can be coded as follows: //STEP 1 EXEC //DD 1 DD // // Concepts PGM=PROGA DSN=XYZ, DISP=(NEW, CATLG), VOL=REF=ABC © Copyright IBM Corp. , 2000, 2004. All rights reserved. 107
z/OS MVS JCL Introduction Unit: Using Special DD Statements Topic: Using Backward Reference VOL Backward Reference - Example 2 In this example the backward reference refers to a specific volume serial number coded on a prior DD statement. The data set XYZ will be created on the volume referred to by the DD statement DD 2 (volume 123456). Concepts //STEPA //DD 2 // //DD 1 // // EXEC PGM=PROGA DD DSN=ABC, VOL=SER=123456, DISP=SHR, UNIT=SYSDA DD DSN=XYZ, DISP=(NEW, CATLG), VOL=REF=*. DD 2, … © Copyright IBM Corp. , 2000, 2004. All rights reserved. 108
z/OS MVS JCL Introduction Unit: Using Special DD Statements Topic: Using Backward Reference DCB Backward Reference – An Example Assume that in STEP 2 you want to create a data set with the same parameters as a data set in STEP 1. The code shown ensures that the attributes on the DD 2 statement are the same as those on the DD 1 statement. Concepts //STEP 1 //DD 1 // // //STEP 2 //DD 2 EXEC DD PGM=PROG 1 DCB=(RECFM=FB, LRECL=80, BLKSIZE=800). . . PGM=PROG 2 DCB=*STEP 1. DD 1, . . . © Copyright IBM Corp. , 2000, 2004. All rights reserved. 109
z/OS MVS JCL Introduction Unit: Using Special DD Statements Topic: Using Backward Reference DCB Backward Reference – Overriding A DCB backward reference can also be used to override or add to the subparameters coded on a previous statement. The format for overriding a previous statement is as follows: DCB=(*. stepname. ddname, list-of attributes) The values of the DCB parameters being referred will be overridden by the values that are being coded. Any attributes that do not match the DCB being referred will be added. Continued… Concepts © Copyright IBM Corp. , 2000, 2004. All rights reserved. 110
z/OS MVS JCL Introduction Unit: Using Special DD Statements Topic: Concatenating Data Sets Data Set Concatenation – An Example Consider a cost ledger system to produce a monthly cost summary file. At the year end, it is required to process all 12 monthly data sets to produce an annual report. All the data sets are concatenated so that they can be processed sequentially. In this example, the program uses a ddname of LEDGER and the monthly data sets are named JAN, FEB, MAR and so on. The operating system draws the concatenated data sets sequentially, treating them as a single logical data set. Concepts © Copyright IBM Corp. , 2000, 2004. All rights reserved. 111
z/OS MVS JCL Introduction Unit: Using Special DD Statements Topic: Concatenating Data Sets JCL for Data Set Concatenation – An Example The JCL here shows the concatenation of the monthly data sets considered in the LEDGER example. The last data set concatenated to LEDGER is DEC. The occurrence of the ddname SUM indicates that the data set (ACCT. 1999) is to be processed separately from the LEDGER data sets. Concepts //LEDGER DD DSN=JAN, DISP=SHR // DD DSN=FEB, DISP=SHR. . . // DD DSN=DEC, DISP=SHR //SUM DD DSN=ACCT. 1999, DISP=SHR © Copyright IBM Corp. , 2000, 2004. All rights reserved. 112
z/OS MVS JCL Introduction Unit: Using Special DD Statements Topic: Dummy Data Sets Overview Each data set that is referred by a program should have a ddname. The JCL for the program must contain the corresponding DD statements. If a data set is not coded by a DD statement, then the program will abnormally end (ABEND) as shown. When an input data set is optional for the program’s processing or when an output data set is not required dummy data sets can be used. Concepts © Copyright IBM Corp. , 2000, 2004. All rights reserved. 113
z/OS MVS JCL Introduction Unit: Using Special DD Statements Topic: Dummy Data Sets Specifying Dummy Data Sets Dummy data sets can be specified in DD statements by doing one of the following: • Coding DUMMY as the first DD parameter Syntax: //ddname DD • DUMMY Coding DSN=NULLFILE Syntax: //ddname DD DSN=NULLFILE is a reserved word and a data set cannot be named as NULLFILE. Concepts © Copyright IBM Corp. , 2000, 2004. All rights reserved. 114
z/OS MVS JCL Introduction Unit: Using Special DD Statements Topic: Dummy Data Sets – An Example Consider a payroll program named PAY that processes separate input data sets. The ddname TIMECDS refers to weekly time cards and the ddname ADJUST refers to adjustments to previous pay period information. The job stream must include: //STEPA //TIMECDS //ADJUST EXEC DD DD PGM=PAY ----. . . Continued… Concepts © Copyright IBM Corp. , 2000, 2004. All rights reserved. 115
z/OS MVS JCL Introduction Unit: Using Special DD Statements Topic: Dummy Data Sets – An Example (cont’d) Even if there are no adjustments for PAY process, DD statement for ADJUST must be included. To tell the system that there is no ADJUST data set code can be written as follows: //STEPA //TIMECDS //ADJUST EXEC DD DD PGM=PAY ---DUMMY If the data set described by the DD statement named ADJUST is referred to by the PAY program, an immediate end-of-file occurs. The program will continue as if it has processed the entire data set. Concepts © Copyright IBM Corp. , 2000, 2004. All rights reserved. 116
z/OS MVS JCL Introduction Unit: Using Special DD Statements Topic: Storage Dumps What are Storage Dumps? When a program abnormally terminates, storage dumps are used as a debugging tool to find clues to the cause for abnormal ending. Storage dumps are not the most effective debugging tool. The main drawbacks of storage dumps are: Concepts • They are difficult to read since they are printed in hexadecimal code • Printing storage dumps is time consuming © Copyright IBM Corp. , 2000, 2004. All rights reserved. 117
z/OS MVS JCL Introduction Unit: Using Special DD Statements Topic: Storage Dumps Special DDnames These reserved ddnames request storage dumps in the event that a program terminates abnormally: Concepts • SYSUDUMP: Requests a formatted dump of the processing program area. It is most generally used for debugging problem programs. • SYSABEND: Requests a formatted dump of the processing program area, system programs and the system control blocks. It is often spooled for printing, although it may be written onto any output device. • SYSMDUMP: Requests an unformatted dump of the processing program area and the system nucleus in machine-readable form. It is generally directed to tape (or to direct access storage) to allow subsequent processing by a dump analysis utility. © Copyright IBM Corp. , 2000, 2004. All rights reserved. 118
z/OS MVS JCL Introduction Unit: Using Special DD Statements Topic: Storage Dumps Handling Storage Dumps It is necessary to plan ahead for a possible storage dump. To obtain a dump, the SYSUDUMP, SYSABEND, or SYSMDUMP DD statements must be coded in the JCL for each job step from which a dump needs to be obtained. //STEP 1 //SYSDUMP //DD 1 //STEP 2 //SYSDUMP EXEC DD DD EXEC DD PGM=PROG 1 SYSOUT=X. . . PGM=PROG 2 SYSOUT=X The example shown uses SYSUDUMP DD statement. If STEP 1 or STEP 2 terminates abnormally, the system creates a dump of the program storage area. Concepts © Copyright IBM Corp. , 2000, 2004. All rights reserved. 119
z/OS MVS JCL Introduction Unit: Modifying EXEC Parameters Unit Objectives At the end of this unit, you will be able to: • Specify what factors determine if a procedure meets the requirements of a job • Invoke a procedure, making temporary alterations to it if necessary • Add, override or nullify parameters on procedure step EXEC statements • Correctly sequence multiple changes to EXEC statement parameters Introduction © Copyright IBM Corp. , 2000, 2004. All rights reserved. 120
z/OS MVS JCL Introduction Unit: Modifying EXEC Parameters Topic: Analyzing Procedures Identifying Analysis Criteria A procedure listing is obtained and examined to ensure that it meets the following two criteria: Concepts • The procedure invokes the proper programs in the desired sequence • Most of the DD statements are usable without major alteration © Copyright IBM Corp. , 2000, 2004. All rights reserved. 121
z/OS MVS JCL Introduction Unit: Modifying EXEC Parameters Topic: Analyzing Procedures Identifying Analysis Criteria - An Example Consider a case in which a company buys goods wholesale from several manufacturers and markets them retail to other customers. Each week the customer order department creates a transaction file that contains new customer orders for the week. A list of orders to be filled is sent to the warehouse and an invoice is sent to each customer. The order list and associated invoices are printed once a week. Continued… Concepts © Copyright IBM Corp. , 2000, 2004. All rights reserved. 122
z/OS MVS JCL Introduction Unit: Modifying EXEC Parameters Topic: Analyzing Procedures Identifying Analysis Criteria - An Example (cont’d) A program named PROG 1 checks the weekly input transactions against entries in a master customer data set. Valid transactions are written to a new data set used as input for another program named PROG 2. PROG 1 refers to the following data sets: DD 1: Refers to the input transactions DD 2: Refers to the master customer data set DD 3: Refers to the transaction exception report DD 4: Refers to the set of valid transactions that are passed to PROG 2 Continued… Concepts © Copyright IBM Corp. , 2000, 2004. All rights reserved. 123
z/OS MVS JCL Introduction Unit: Modifying EXEC Parameters Topic: Analyzing Procedures Identifying Analysis Criteria - An Example (cont’d) Shown on the right is the procedure named TRANSACT that is used to accomplish this task. A procedure listing is obtained to determine: Concepts • If it uses the required programs in the required sequence • If it uses appropriate data sets //PSTEP 1 EXEC PGM=PROG 1, TIME=(1, 30) //DD 1 DD DSN=INTRAN, DISP=SHR //DD 2 DD DSN=MASTER, DISP=SHR //DD 3 DD SYSOUT=A //DD 4 DD DSN=&&VALID, // UNIT=SYSDA, DISP=(NEW, PASS), // SPACE=(TRK, (1, 1)) //PSTEP 2 EXEC PGM=PROG 2, TIME=5 //DD 5 DD DSN=&&VALID, // DISP=(OLD, DELETE) //DD 6 DD SYSOUT=A © Copyright IBM Corp. , 2000, 2004. All rights reserved. 124
z/OS MVS JCL Introduction Unit: Modifying EXEC Parameters Topic: Analyzing Procedures Analysis Explanation The listing for the procedure TRANSACT indicates the following: The procedure executes 2 programs: PROG 1 and PROG 2. PROG 1 uses the following data sets: • A cataloged data set named INTRAN (DD 1 DD statement) • A cataloged data set named MASTER (DD 2 DD statement) • SYSOUT class A output (DD 3 DD statement) • A temporary data set named &&VALID that is passed to PROG 2 (DD 4 DD statement) //PSTEP 1 EXEC PGM=PROG 1, TIME=(1, 30) //DD 1 DD DSN=INTRAN, DISP=SHR //DD 2 DD DSN=MASTER, DISP=SHR //DD 3 DD SYSOUT=A //DD 4 DD DSN=&&VALID, // UNIT=SYSDA, DISP=(NEW, PASS), // SPACE=(TRK, (1, 1)) //PSTEP 2 EXEC PGM=PROG 2, TIME=5 //DD 5 DD DSN=&&VALID, // DISP=(OLD, DELETE) //DD 6 DD SYSOUT=A Continued… Concepts © Copyright IBM Corp. , 2000, 2004. All rights reserved. 125
z/OS MVS JCL Introduction Unit: Modifying EXEC Parameters Topic: Analyzing Procedures Analysis Explanation (cont’d) PROG 2 uses the following data sets: • A temporary data set named &&VALID, which is passed from PROG 1 (DD 5 DD statement) • SYSOUT class A output (DD 6 DD statement) In addition, a TIME parameter is included on the PSTEP 1 and PSTEP 2 EXEC statements to restrict the amount of time the programs are permitted to use the central processor. //PSTEP 1 EXEC PGM=PROG 1, TIME=(1, 30) //DD 1 DD DSN=INTRAN, DISP=SHR //DD 2 DD DSN=MASTER, DISP=SHR //DD 3 DD SYSOUT=A //DD 4 DD DSN=&&VALID, // UNIT=SYSDA, DISP=(NEW, PASS), // SPACE=(TRK, (1, 1)) //PSTEP 2 EXEC PGM=PROG 2, TIME=5 //DD 5 DD DSN=&&VALID, // DISP=(OLD, DELETE) //DD 6 DD SYSOUT=A Continued… Concepts © Copyright IBM Corp. , 2000, 2004. All rights reserved. 126
z/OS MVS JCL Introduction Unit: Modifying EXEC Parameters Topic: Changing EXEC Parameters Coding Changes A procedure listing helps a programmer to analyze the procedure for its usability. In some cases a procedure might satisfy all the basic requirements for usability, but might need some minor alterations. This can be done by changing the EXEC and DD parameters when the procedure is invoked. However, these alterations are applicable only for one invocation. They do not permanently modify the procedure definition. Continued… Concepts © Copyright IBM Corp. , 2000, 2004. All rights reserved. 127
z/OS MVS JCL Introduction Unit: Modifying EXEC Parameters Topic: Changing EXEC Parameters Coding Changes (cont’d) Changes can be made to procedure EXEC statement parameters such as TIME, ACCT, and PARM. The programmer can change these parameters in the following ways: • • • Concepts Override the parameters on the procedure EXEC statement //STEP 1 EXEC //DD 1 DD parameter //DD 2 DD parameter Override Nullify parameters on the procedure EXEC statement Add parameters to the procedure EXEC statement procedure name, parameter Add New DD Statement © Copyright IBM Corp. , 2000, 2004. All rights reserved. 128
z/OS MVS JCL Introduction Unit: Modifying EXEC Parameters Topic: Override Statements Overriding Statement Parameters An override statement is used to change an existing parameter value. Consider the TRANSACT procedure discussed in Unit 3, Topic 1 – Analyzing procedures. The procedure definition is shown on the right. Note that the time that PROG 1 can run is 1 minute 30 seconds. Assume that for a particular week, the transaction file to be processed is too large and the time that PROG 1 can run needs to be increased to 3 minutes. //PSTEP 1 //DD 2 //DD 3 //DD 4 // //PSTEP 2 //DD 5 // //DD 6 EXEC DD DD EXEC DD PGM=PROG 1, TIME=(1, 30) DSN=INTRAN, DISP=SHR DSN=MASTER, DISP=SHR SYSOUT=A DSN=&&VALID, DISP=(NEW, PASS), UNIT=SYSDA, SPACE=(TRK, (1, 1)) PGM=PROG 2, TIME=5 DSN=&&VALID, DISP=(OLD, DELETE) DD SYSOUT=A Continued… Concepts © Copyright IBM Corp. , 2000, 2004. All rights reserved. 129
z/OS MVS JCL Introduction Unit: Modifying EXEC Parameters Topic: Override Statements Overriding Statement Parameters (cont’d) To override the original time parameter, the TRANSACT can be invoked with the following EXEC statement: //JSTEP EXEC TRANSACT, TIME. PSTEP 1=3 Shown on the right is the resulting JCL. Note the new parameter in the resulting JCL. However, this override is only temporary. The procedure definition does not change. The next time the procedure is invoked, it will revert to the original definition. Concepts //PSTEP 1 //DD 2 //DD 3 //DD 4 // //PSTEP 2 //DD 5 // //DD 6 EXEC DD DD EXEC DD PGM=PROG 1, TIME=3 DSN=INTRAN, DISP=SHR DSN=MASTER, DISP=SHR SYSOUT=A DSN=&&VALID, DISP=(NEW, PASS), UNIT=SYSDA, SPACE=(TRK, (1, 1)) PGM=PROG 2, TIME=5 DSN=&&VALID, DISP=(OLD, DELETE) DD SYSOUT=A © Copyright IBM Corp. , 2000, 2004. All rights reserved. 130
z/OS MVS JCL Introduction Unit: Modifying EXEC Parameters Topic: Addition Statements Adding Parameters to a Procedure Addition statements are used to add parameters to a procedure. The programmer can code additions on the EXEC statement that invokes the procedure. Consider the TRANSACT procedure discussed in Unit 3, Topic 1 – Analyzing procedures. Assume that a programmer wants to supply the current date for PROG 1. This parameter can be coded in the following way while invoking the procedure: //JSTEP EXEC procedurename, // parameter. procstepname=value //JSTEP EXEC TRANSACT, // PARM. PSTEP 1=’ 01/29/99’ Addition Continued… Concepts © Copyright IBM Corp. , 2000, 2004. All rights reserved. 131
z/OS MVS JCL Introduction Unit: Modifying EXEC Parameters Topic: Addition Statements Adding Parameters to a Procedure (cont’d) The following EXEC statement supplies the current date for PROG 1 and PROG 2: //JSTEP EXEC TRANSACT, // PARM. PSTEP 1=’ 01/29/91’, // PARM. PSTEP 2=’ 01/29/91’ The resulting JCL is shown on the right. Concepts //PSTEP 1 // //DD 1 //DD 2 //DD 3 //DD 4 // //PSTEP 2 // //DD 5 // //DD 6 EXEC DD DD PGM=PROG 1, TIME=(1, 30) PARM=’ 01/29/91’ DSN=INTRAN, DISP=SHR DSN=MASTER, DISP=SHR SYSOUT=A DSN=&&VALID, DISP=(NEW, PASS), UNIT=SYSDA, SPACE=(TRK, (1, 1)) PGM=PROG 2, TIME=5 PARM=’ 01/29/91’ DSN=&&VALID, DISP=(OLD, DELETE) SYSOUT=A © Copyright IBM Corp. , 2000, 2004. All rights reserved. 132
z/OS MVS JCL Introduction Unit: Modifying EXEC Parameters Topic: Sequencing Multiple Changes – An Example Consider the TRANSACT procedure discussed in Unit 3, Topic 1 – Analyzing procedures. The following alterations are to be made to the EXEC statement operands in the procedure: • Increase the time restriction for PSTEP 1 to 3 minutes • Revert to the installation-defined TIME default for PSTEP 2 • Add a PARM parameter value of 01/29/99 for the EXEC statements in PSTEP 1 and PSTEP 2 //JSTEP EXEC TRANSACT, TIME. PSTEP 1=3, // PARM. PSTEP 1=’ 01/29/99’, // TIME. PSTEP 2=, // PARM. PSTEP 2=’ 01/29/99’ The JCL statements on the right show to combine these alterations on the EXEC statement that invokes the procedure. Concepts © Copyright IBM Corp. , 2000, 2004. All rights reserved. 133
- Slides: 133