JCL básico unidad 3

Embed Size (px)

Citation preview

  • 7/30/2019 JCL bsico unidad 3

    1/73

    z/OS MVS JCL Introduction

    Copyright IBM Corp., 2000, 2004. All rights reserved.

  • 7/30/2019 JCL bsico unidad 3

    2/73

    z/OS MVS JCL Introduction

    Copyright IBM Corp., 2000, 2004. All rights reserved. Page 2 of 73

    UNIT Coding EXEC Statements

    The EXEC Statement

    The EXEC Parameter Field

    Additional EXEC Parameters

    The PARM Parameter

    The COND Parameter

    The System Library

    The STEPLIB DD Statement

    Topics:

  • 7/30/2019 JCL bsico unidad 3

    3/73

    z/OS MVS JCL Introduction

    Copyright IBM Corp., 2000, 2004. All rights reserved. Page 3 of 73

    Unit Introduction

    Each job begins with an EXEC statement. This statement identifies the name of the program that has to be

    executed for a particular job. You have to code an EXEC statement for each program that you have to

    execute in a job.

    This unit will explain to you how to be able to code a simple EXEC statement and identify the reasons for

    basic JCL errors.

    Unit: Coding EXEC Statements

    Introduction

  • 7/30/2019 JCL bsico unidad 3

    4/73

    z/OS MVS JCL Introduction

    Copyright IBM Corp., 2000, 2004. All rights reserved. Page 4 of 73

    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 NOTFOUND error message

    Identify the system library from which programs are retrieved atexecution 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 JOBLIBDD statements should be located

    Code a JOBLIB DD statement

    Unit Objectives

    Unit: Coding EXEC Statements

    Introduction

  • 7/30/2019 JCL bsico unidad 3

    5/73

    z/OS MVS JCL Introduction

    Copyright IBM Corp., 2000, 2004. All rights reserved. Page 5 of 73

    UNIT Coding EXEC Statements

    The EXEC Statement

    The EXEC Parameter Field

    Additional EXEC Parameters

    The PARM Parameter

    The COND Parameter

    The System Library

    The STEPLIB DD Statement

    Topics:

  • 7/30/2019 JCL bsico unidad 3

    6/73

    z/OS MVS JCL Introduction

    Copyright IBM Corp., 2000, 2004. All rights reserved. Page 6 of 73

    At the end of this topic, you will be able to:

    Code an EXEC statement to invoke a program

    Correct coding errors in an EXEC statement

    Topic Objectives

    Unit: Coding EXEC Statements Topic: The EXEC Statement

    Introduction

  • 7/30/2019 JCL bsico unidad 3

    7/73

    z/OS MVS JCL Introduction

    Copyright IBM Corp., 2000, 2004. All rights reserved. Page 7 of 73

    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 JCLstatements that are stored in a library and

    retrieved by its name.

    A procedure may contain one or more EXEC

    statements.

    The EXEC Statement

    Procedure

    Unit: Coding EXEC Statements Topic: The EXEC Statement

    ConceptsContinued

  • 7/30/2019 JCL bsico unidad 3

    8/73

    z/OS MVS JCL Introduction

    Copyright IBM Corp., 2000, 2004. All rights reserved. Page 8 of 73

    In Unit 2Coding 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

    The EXEC Statement (contd)

    Identifier Name Operation Parameter Comment

    Unit: Coding EXEC Statements Topic: The EXEC Statement

    Concepts

    Continued

  • 7/30/2019 JCL bsico unidad 3

    9/73

    z/OS MVS JCL Introduction

    Copyright IBM Corp., 2000, 2004. All rights reserved. Page 9 of 73

    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.

    The EXEC Statement (contd)

    Code a step name on all your EXEC statementseven if there might not be any references tothose statements.

    //STEP1 EXEC PGM=IEBUPDTE

    Step

    Name

    Operator

    Positional

    Parameter

    Unit: Coding EXEC Statements Topic: The EXEC Statement

    Concepts

  • 7/30/2019 JCL bsico unidad 3

    10/73

    z/OS MVS JCL Introduction

    Copyright IBM Corp., 2000, 2004. All rights reserved. Page 10 of 73

    It is important for you to always follow the JCLstep name coding rules while naming a step. Notdoing 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 8characters in length

    The first character in the step nameshould be either alphabetic or a nationalsymbol

    The first character cannot be a number

    Rest of the characters in the step namecan either be alphanumeric or they canbe national symbols

    Special characters and spaces cannotbe used in a step name

    The Step Name

    //STEP1 EXEC

    //EXAMPLE4 EXEC

    //RUN#2 EXEC

    //STEP1+ EXEC

    //EXAMPLE14 EXEC

    // RUN#2 EXEC

    Valid Step Names

    Invalid Step Names

    (Includes a special character)

    (More than eight characters)

    (Does not begin in position 3)

    Unit: Coding EXEC Statements Topic: The EXEC Statement

    Concepts

    Continued

  • 7/30/2019 JCL bsico unidad 3

    11/73

    z/OS MVS JCL Introduction

    Copyright IBM Corp., 2000, 2004. All rights reserved. Page 11 of 73

    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 forcoding 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.

    The Step Name (contd)

    //STEP#FOUR EXEC PGM=IEFBR14

    //LA$JOE EXEC PGM=IEGENER

    Unit: Coding EXEC Statements Topic: The EXEC Statement

    Concepts

  • 7/30/2019 JCL bsico unidad 3

    12/73

    z/OS MVS JCL Introduction

    Copyright IBM Corp., 2000, 2004. All rights reserved. Page 12 of 73

    Which of the following step names are valid?

    A. $STEP#5

    B. RUN TWO

    C. *STEP4

    D. EXAMPLE#12

    Are We on Track?

    Unit: Coding EXEC Statements Topic: The EXEC Statement

    Review

  • 7/30/2019 JCL bsico unidad 3

    13/73

    z/OS MVS JCL Introduction

    Copyright IBM Corp., 2000, 2004. All rights reserved. Page 13 of 73

    Procedure Prepared sets of job control statements cataloged in a procedure library

    Glossary

    Unit: Coding EXEC Statements Topic: The EXEC Statement

    Glossary

  • 7/30/2019 JCL bsico unidad 3

    14/73

    z/OS MVS JCL Introduction

    Copyright IBM Corp., 2000, 2004. All rights reserved. Page 14 of 73

    Now that you have completed this topic, you should be able to:

    Code an EXEC statement to invoke a program

    Correct coding errors in an EXEC statement

    Topic Summary

    Unit: Coding EXEC Statements Topic: The EXEC Statement

    Summary

  • 7/30/2019 JCL bsico unidad 3

    15/73

    z/OS MVS JCL Introduction

    Copyright IBM Corp., 2000, 2004. All rights reserved. Page 15 of 73

    UNIT Coding EXEC Statements

    The EXEC Statement

    The EXEC Parameter Field

    Additional EXEC Parameters

    The PARM Parameter

    The COND Parameter

    The System Library

    The STEPLIB DD Statement

    Topics:

  • 7/30/2019 JCL bsico unidad 3

    16/73

    z/OS MVS JCL Introduction

    Copyright IBM Corp., 2000, 2004. All rights reserved. Page 16 of 73

    At the end of this topic, you will be able to:

    Code the positional parameters on an EXEC statement

    Correct coding errors in an EXEC statement

    Identify which JCL statement has caused a PROGRAMNOT FOUND error message

    Topic Objectives

    Unit: Coding EXEC Statements Topic: The EXEC Parameter Field

    Introduction

  • 7/30/2019 JCL bsico unidad 3

    17/73

    z/OS MVS JCL Introduction

    Copyright IBM Corp., 2000, 2004. All rights reserved. Page 17 of 73

    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=.

    The Positional Parameter

    //STEP1 EXEC procedure-name

    //STEP2 EXEC PROC=procedure

    //STEP1 EXEC PGM=program-name

    Positional

    Parameter

    Unit: Coding EXEC Statements Topic: The EXEC Parameter Field

    Concepts

  • 7/30/2019 JCL bsico unidad 3

    18/73

    z/OS MVS JCL Introduction

    Copyright IBM Corp., 2000, 2004. All rights reserved. Page 18 of 73

    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.

    The PGM= Positional Parameter

    Payroll

    //JOB1 JOB 3SPO3W,CLASS=B

    //STEP1 EXEC PGM=PAYROLL

    Program

    Unit: Coding EXEC Statements Topic: The EXEC Parameter Field

    Concepts

  • 7/30/2019 JCL bsico unidad 3

    19/73

    z/OS MVS JCL Introduction

    Copyright IBM Corp., 2000, 2004. All rights reserved. Page 19 of 73

    Code the EXEC statement using the proper operator where the step name is STEP1 and the nameof program is PAYROLL?

    //JOB1 JOB 255,SMITH

    Are We on Track?

    Unit: Coding EXEC Statements Topic: The EXEC Parameter Field

    Review

  • 7/30/2019 JCL bsico unidad 3

    20/73

    z/OS MVS JCL Introduction

    Copyright IBM Corp., 2000, 2004. All rights reserved. Page 20 of 73

    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.

    The PROC= Positional Parameter

    //LA$JOE JOB 3SPO3W,CLASS=B

    //STEP1 EXEC PROC=MYPROC

    Procedure

    Unit: Coding EXEC Statements Topic: The EXEC Parameter Field

    Concepts

  • 7/30/2019 JCL bsico unidad 3

    21/73

    z/OS MVS JCL Introduction

    Copyright IBM Corp., 2000, 2004. All rights reserved. Page 21 of 73

    If you omit the PGM= or PROC= keyword, theoperating 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 namedMYPROC from a step named STEP3, you will

    need to code the EXEC statement as shown on

    the right.

    Omitting the PROC= Keyword

    //STEP3 EXEC procedure-name

    //STEP3 EXEC MYPROC

    Unit: Coding EXEC Statements Topic: The EXEC Parameter Field

    Concepts

  • 7/30/2019 JCL bsico unidad 3

    22/73

    z/OS MVS JCL Introduction

    Copyright IBM Corp., 2000, 2004. All rights reserved. Page 22 of 73

    If you leave out the PGM= or PROC= keyword when coding an EXEC statement, what does the

    operating system do automatically?

    A. Search for a procedure with the specified name.

    B. Search for a program with the specified name.

    C. Search all programs and procedures with the specified name

    D. Display an error and cause an abnormal termination.

    Are We on Track?

    Unit: Coding EXEC Statements Topic: The EXEC Parameter Field

    Review

  • 7/30/2019 JCL bsico unidad 3

    23/73

    z/OS MVS JCL Introduction

    Copyright IBM Corp., 2000, 2004. All rights reserved. Page 23 of 73

    JCL errors occur if you, as a JCL programmer failto follow any of the coding rules regarding the

    PGM and PROC positional parameters.

    For example, the misspelling of PGM (as PGR) in

    the EXEC statement shown here returns a JCL

    error.

    Positional Parameter Coding Errors

    //LA$JOE JOB 3SPO3W,CLASS=B

    //STEP1 EXEC PGR=IEFBR14

    Unit: Coding EXEC Statements Topic: The EXEC Parameter Field

    Concepts

    Continued

  • 7/30/2019 JCL bsico unidad 3

    24/73

    z/OS MVS JCL Introduction

    Copyright IBM Corp., 2000, 2004. All rights reserved. Page 24 of 73

    In the example shown here, 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 for 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.

    Positional Parameter Coding Errors (contd)

    //LA$JOE JOB 3SPO3W,CLASS=B

    //STEP1 EXEC PGM = IEFBR14

    SYSTEM ABEND

    Unit: Coding EXEC Statements Topic: The EXEC Parameter Field

    Concepts

  • 7/30/2019 JCL bsico unidad 3

    25/73

    z/OS MVS JCL Introduction

    Copyright IBM Corp., 2000, 2004. All rights reserved. Page 25 of 73

    Now that you have completed this topic, you should be able to:

    Code the positional parameters on an EXEC statement

    Identify the JCL errors in coding the positionalparameters on an EXEC statement

    Topic Summary

    Unit: Coding EXEC Statements Topic: The EXEC Parameter Field

    Summary

  • 7/30/2019 JCL bsico unidad 3

    26/73

    z/OS MVS JCL Introduction

    Copyright IBM Corp., 2000, 2004. All rights reserved. Page 26 of 73

    UNIT Coding EXEC Statements

    The EXEC Statement

    The EXEC Parameter Field

    Additional EXEC Parameters

    The PARM Parameter

    The COND Parameter

    The System Library

    The STEPLIB DD Statement

    Topics:

  • 7/30/2019 JCL bsico unidad 3

    27/73

    z/OS MVS JCL Introduction

    Copyright IBM Corp., 2000, 2004. All rights reserved. Page 27 of 73

    At the end of this topic, you will be able to:

    Identify some keyword parameters used in the EXECstatement

    Topic Objectives

    Introduction

    Unit: Coding EXEC Statements Topic: Additional EXEC Parameters

  • 7/30/2019 JCL bsico unidad 3

    28/73

    z/OS MVS JCL Introduction

    Copyright IBM Corp., 2000, 2004. All rights reserved. Page 28 of 73

    In addition to programs, you can use the EXECstatement 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.

    Procedures

    Concepts

    Unit: Coding EXEC Statements Topic: Additional EXEC Parameters

  • 7/30/2019 JCL bsico unidad 3

    29/73

    z/OS MVS JCL Introduction

    Copyright IBM Corp., 2000, 2004. All rights reserved. Page 29 of 73

    A ____________ is a set of associated EXEC and DD statements stored in a library.

    Are We on Track?

    Review

    Unit: Coding EXEC Statements Topic: Additional EXEC Parameters

  • 7/30/2019 JCL bsico unidad 3

    30/73

    z/OS MVS JCL Introduction

    Copyright IBM Corp., 2000, 2004. All rights reserved. Page 30 of 73

    You may code keyword parameters on the EXECstatement 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:

    The PARM parameter

    The COND parameter

    Keyword Parameters

    PGM=PROGA,keyword

    ACCT

    RD

    DYNAMNBR

    ADDRSPC

    PERFORM

    REGION

    PARM

    COND

    TIME

    DPRTY

    CCSID

    Concepts

    Unit: Coding EXEC Statements Topic: Additional EXEC Parameters

  • 7/30/2019 JCL bsico unidad 3

    31/73

    z/OS MVS JCL Introduction

    Copyright IBM Corp., 2000, 2004. All rights reserved. Page 31 of 73

    Now that you have completed this topic, you should be able to:

    Identify some keyword parameters used in the EXECstatement

    Topic Summary

    Summary

    Unit: Coding EXEC Statements Topic: Additional EXEC Parameters

  • 7/30/2019 JCL bsico unidad 3

    32/73

    z/OS MVS JCL Introduction

    Copyright IBM Corp., 2000, 2004. All rights reserved. Page 32 of 73

    UNIT Coding EXEC Statements

    The EXEC Statement

    The EXEC Parameter Field

    Additional EXEC Parameters

    The PARM Parameter

    The COND Parameter

    The System Library

    The STEPLIB DD Statement

    Topics:

  • 7/30/2019 JCL bsico unidad 3

    33/73

    z/OS MVS JCL Introduction

    Copyright IBM Corp., 2000, 2004. All rights reserved. Page 33 of 73

    At the end of this topic, you will be able to:

    Explain the purpose of the PARM keyword parameter onan EXEC statement

    Explain the basic syntax and rules for coding the PARMparameter

    Topic Objectives

    Unit: Coding EXEC Statements Topic: The PARM Parameter

    Concepts

    /OS MVS JCL I d i

  • 7/30/2019 JCL bsico unidad 3

    34/73

    z/OS MVS JCL Introduction

    Copyright IBM Corp., 2000, 2004. All rights reserved. Page 34 of 73

    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)

    Unit: Coding EXEC Statements Topic: The PARM Parameter

    Concepts

    /OS MVS JCL I t d ti

  • 7/30/2019 JCL bsico unidad 3

    35/73

    z/OS MVS JCL Introduction

    Copyright IBM Corp., 2000, 2004. All rights reserved. Page 35 of 73

    Rules for Coding the PARM Parameter

    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

    Unit: Coding EXEC Statements Topic: The PARM Parameter

    Concepts

    /OS MVS JCL I t d ti

  • 7/30/2019 JCL bsico unidad 3

    36/73

    z/OS MVS JCL Introduction

    Copyright IBM Corp., 2000, 2004. All rights reserved. Page 36 of 73

    Which EXEC statement keyword parameter passes up to 100 characters of data to a program?

    A. COND

    B. PERFORM

    C. PARM

    D. ACCT

    Are We on Track?

    Review

    Unit: Coding EXEC Statements Topic: The PARM Parameter

    /OS MVS JCL I t d ti

  • 7/30/2019 JCL bsico unidad 3

    37/73

    z/OS MVS JCL Introduction

    Copyright IBM Corp., 2000, 2004. All rights reserved. Page 37 of 73

    This EXEC statement passes one value (MONTHLY) as input to a program named REPORT.

    Coding the PARM Parameter Example 1

    //JOB1 JOB 766,SMITH

    //RUN#2 EXEC PGM=REPORT,

    // PARM=MONTHLY

    REPORT

    PARM=MONTHLY

    PARM

    Parameter

    Unit: Coding EXEC Statements Topic: The PARM Parameter

    Concepts

    /OS MVS JCL I t d ti

  • 7/30/2019 JCL bsico unidad 3

    38/73

    z/OS MVS JCL Introduction

    Copyright IBM Corp., 2000, 2004. All rights reserved. Page 38 of 73

    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.

    Coding the PARM Parameter Example 2

    //JOB1 JOB 766,SMITH

    //RUN#2 EXEC PGM=REPORT,

    // PARM=10-31-98

    REPORT

    PARM=10-31-98

    PARM

    Parameter

    Unit: Coding EXEC Statements Topic: The PARM Parameter

    Concepts

    z/OS MVS JCL Introduction

  • 7/30/2019 JCL bsico unidad 3

    39/73

    z/OS MVS JCL Introduction

    Copyright IBM Corp., 2000, 2004. All rights reserved. Page 39 of 73

    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.

    Coding the PARM Parameter Example 3

    //JOB1 JOB 766,SMITH

    //RUN#2 EXEC PGM=REPORT,

    // PARM=(MONTHLY,10-31-98)

    REPORT

    PARM=(MONTHLY,

    10-31-98)

    PARM

    Parameter

    Unit: Coding EXEC Statements Topic: The PARM Parameter

    Concepts

    z/OS MVS JCL Introduction

  • 7/30/2019 JCL bsico unidad 3

    40/73

    z/OS MVS JCL Introduction

    Copyright IBM Corp., 2000, 2004. All rights reserved. Page 40 of 73

    Complete the EXEC statement using the PARM parameter to pass on both the type of report(MONTHLY) and the date (10-31-98).

    //JOB1 JOB 776,SMITH

    //RUN#3 EXEC PGM=REPORT,_________________

    Are We on Track?

    Unit: Coding EXEC Statements Topic: The PARM Parameter

    Review

    z/OS MVS JCL Introduction

  • 7/30/2019 JCL bsico unidad 3

    41/73

    z/OS MVS JCL Introduction

    Copyright IBM Corp., 2000, 2004. All rights reserved. Page 41 of 73

    The Loader Program

    Occasionally, you might use the LOADER program when testing programs. The LOADER creates a programmodule in storage and passes control to it.

    If you are coding the PARM parameter when using the LOADER, use the special syntax as shown here:

    //GO EXEC PGM=LOADER,

    // PARM=(loader parameters/user program parameters)

    What are the programs to which you can give the PARM parameter to?

    You can give PARM values to two programs:

    The Loader

    The module created by the Loader

    The slash within the PARM parameter separates the Loader parameters from those given to the user

    program.

    Unit: Coding EXEC Statements Topic: The PARM Parameter

    Concepts

    z/OS MVS JCL Introduction

  • 7/30/2019 JCL bsico unidad 3

    42/73

    z/OS MVS JCL Introduction

    Copyright IBM Corp., 2000, 2004. All rights reserved. Page 42 of 73

    The ________ creates a program module in storage and passes control to it. The program then

    executes.

    Are We on Track?

    Unit: Coding EXEC Statements Topic: The PARM Parameter

    Review

    z/OS MVS JCL Introduction

  • 7/30/2019 JCL bsico unidad 3

    43/73

    z/OS MVS JCL Introduction

    Copyright IBM Corp., 2000, 2004. All rights reserved. Page 43 of 73

    Now that you have completed this topic, you should be able to:

    Explain the purpose of the PARM keyword parameter onan EXEC statement

    Explain the basic syntax and rules for coding the PARMparameter

    Topic Summary

    Unit: Coding EXEC Statements Topic: The PARM Parameter

    Summary

    z/OS MVS JCL Introduction

  • 7/30/2019 JCL bsico unidad 3

    44/73

    z/OS MVS JCL Introduction

    Copyright IBM Corp., 2000, 2004. All rights reserved. Page 44 of 73

    UNIT Coding EXEC Statements

    The EXEC Statement

    The EXEC Parameter Field

    Additional EXEC Parameters

    The PARM Parameter

    The COND Parameter

    The System Library

    The STEPLIB DD Statement

    Topics:

    z/OS MVS JCL Introduction

  • 7/30/2019 JCL bsico unidad 3

    45/73

    z/OS MVS JCL Introduction

    Copyright IBM Corp., 2000, 2004. All rights reserved. Page 45 of 73

    At the end of this topic, you will be able to:

    Explain the purpose of the COND parameter in an EXECstatement

    Code the COND parameter and the various CONDsubparameters in an EXEC statement

    Topic Objectives

    Introduction

    Unit: Coding EXEC Statements Topic: The COND Parameter

    z/OS MVS JCL Introduction

  • 7/30/2019 JCL bsico unidad 3

    46/73

    z/OS MVS JCL Introduction

    Copyright IBM Corp., 2000, 2004. All rights reserved. Page 46 of 73

    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

    Unit: Coding EXEC Statements Topic: The COND Parameter

    z/OS MVS JCL Introduction

  • 7/30/2019 JCL bsico unidad 3

    47/73

    z/OS MVS JCL Introduction

    Copyright IBM Corp., 2000, 2004. All rights reserved. Page 47 of 73

    The COND Subparameters

    As on the JOB statement, the code subparameter indicates a return code, and the operator subparameterindicates the type of test used for the comparison.

    COND=(code,operator)

    or

    COND=(code,operator,stepname)

    orCOND=(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.

    Concepts

    Unit: Coding EXEC Statements Topic: The COND Parameter

    Continued

    z/OS MVS JCL Introduction

  • 7/30/2019 JCL bsico unidad 3

    48/73

    z/OS MVS JCL Introduction

    Copyright IBM Corp., 2000, 2004. All rights reserved. Page 48 of 73

    The COND Subparameters (contd)

    The stepname.procstepname subparameter (instead of the stepname subparameter) compares a code valueagainst 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.

    You can code up to eight comparisons. If any comparison is true, the system bypasses the step.

    Concepts

    Unit: Coding EXEC Statements Topic: The COND Parameter

    z/OS MVS JCL Introduction

  • 7/30/2019 JCL bsico unidad 3

    49/73

    z/OS MVS JCL Introduction

    Copyright IBM Corp., 2000, 2004. All rights reserved. Page 49 of 73

    Like the JOB statement COND parameter, eachtest in an EXEC statement COND parameter has

    its own operator.

    This operator is independent of any other

    operators in any other tests.

    COND Parameter Operators

    GT

    GE

    EQ

    NE

    LT

    LE

    Operator Meaning

    Greater than

    Greater than or equal to

    Equal to

    Not equal to

    Less than

    Less than or equal to

    Concepts

    Unit: Coding EXEC Statements Topic: The COND Parameter

    z/OS MVS JCL Introduction

  • 7/30/2019 JCL bsico unidad 3

    50/73

    z/OS MVS JCL Introduction

    Copyright IBM Corp., 2000, 2004. All rights reserved. Page 50 of 73

    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."

    COND Parameter An Example

    DELETE

    //JOB1 JOB 778,SMITH

    //EXAMPLE2 EXEC PGM=DELETE

    //EXAMPLE3 EXEC PGM=UPDATE,

    // COND=(8,GT)

    //DD1 DD DSN=INPUT

    COND=(8,GT)

    Concepts

    Unit: Coding EXEC Statements Topic: The COND Parameter

    Continued

    z/OS MVS JCL Introduction

  • 7/30/2019 JCL bsico unidad 3

    51/73

    z/OS MVS JCL Introduction

    Copyright IBM Corp., 2000, 2004. All rights reserved. Page 51 of 73

    Code a COND parameter that skips this step if any previous step return code is less than

    equal to 8.

    //STEP2 EXEC PGM=UPDATE,

    Are We on Track?

    Review

    Unit: Coding EXEC Statements Topic: The COND Parameter

    z/OS MVS JCL Introduction

  • 7/30/2019 JCL bsico unidad 3

    52/73

    Copyright IBM Corp., 2000, 2004. All rights reserved. Page 52 of 73

    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."

    COND ParameterAn Example (contd)

    DELETE

    //JOB1 JOB 778,SMITH

    //EXAMPLE2 EXEC PGM=DELETE

    //EXAMPLE3 EXEC PGM=UPDATE,

    // COND=(8,GT,EXAMPLE2)

    //DD1 DD DSN=INPUT

    COND=(8,GT,

    STEP1)

    Concepts

    Unit: Coding EXEC Statements Topic: The COND Parameter

    z/OS MVS JCL Introduction

  • 7/30/2019 JCL bsico unidad 3

    53/73

    Copyright IBM Corp., 2000, 2004. All rights reserved. Page 53 of 73

    The COND Subparameters EVEN & ONLY

    In addition to code, operator, stepname, and procedure stepname, the EVEN and ONLY subparameters mayalso 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 following an abnormal program

    termination.

    The EVEN subparameter allows the current step to execute even if any previous step terminates

    abnormally.

    Conversely, the ONLY subparmeter allows the current step to execute only if any previous step terminates

    abnormally.

    Concepts

    Unit: Coding EXEC Statements Topic: The COND Parameter

    z/OS MVS JCL Introduction

  • 7/30/2019 JCL bsico unidad 3

    54/73

    Copyright IBM Corp., 2000, 2004. All rights reserved. Page 54 of 73

    If you code COND=EVEN on an EXEC statement as shown here, the program STEP4 always executes, even

    if a previous step (e.g. STEP3) in the job terminates abnormally.

    EVEN Subparameter An Example

    //JOB1 JOB 778,SMITH

    //EXAMPLE1 EXEC PGM=STEP1

    //EXAMPLE2 EXEC PGM=STEP2

    //EXAMPLE3 EXEC PGM=STEP3

    //EXAMPLE4 EXEC PGM=STEP4,

    // COND=EVEN

    //DD1 DD DSN=INPUT

    Concepts

    Unit: Coding EXEC Statements Topic: The COND Parameter

    z/OS MVS JCL Introduction

  • 7/30/2019 JCL bsico unidad 3

    55/73

    Copyright IBM Corp., 2000, 2004. All rights reserved. Page 55 of 73

    If you code COND=ONLY on an EXEC statement as shown here, the program STEP4 will execute only if a

    previous step in the job terminates abnormally.

    ONLY Subparameter An Example

    //JOB1 JOB 778,SMITH

    //EXAMPLE1 EXEC PGM=STEP1

    //EXAMPLE2 EXEC PGM=STEP2

    //EXAMPLE3 EXEC PGM=STEP3

    //EXAMPLE4 EXEC PGM=STEP4,

    // COND=ONLY

    //DD1 DD DSN=INPUT

    Concepts

    Unit: Coding EXEC Statements Topic: The COND Parameter

    z/OS MVS JCL Introduction

  • 7/30/2019 JCL bsico unidad 3

    56/73

    Copyright IBM Corp., 2000, 2004. All rights reserved. Page 56 of 73

    The EVEN and ONLY subparameters cannotappear on the same step. They are mutually

    exclusive.

    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.

    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 havebeen coded with an EVEN or ONLYsubparameters on the COND parameter.

    Using the EVEN & ONLY Subparameters

    //ST4 EXEC PGM=PROG7,

    // COND=((10,EQ,STEP5),EVEN)

    //ST4 EXEC PGM=PROG7,

    // COND=(EVEN,(10,EQ,STEP5))

    Concepts

    Unit: Coding EXEC Statements Topic: The COND Parameter

    z/OS MVS JCL Introduction

  • 7/30/2019 JCL bsico unidad 3

    57/73

    Copyright IBM Corp., 2000, 2004. All rights reserved. Page 57 of 73

    Which one of the following statements would you code to run the FIXIT program in case of an

    abnormal termination in the previous step?

    A. //STEP EXEC PGM=FIXIT

    B. //STEP3 EXEC PGM=FIXIT,COND=EVEN

    C. //STEP3 EXEC PGM=FIXIT,COND=ONLY

    Are We on Track?

    Review

    Unit: Coding EXEC Statements Topic: The COND Parameter

    z/OS MVS JCL Introduction

  • 7/30/2019 JCL bsico unidad 3

    58/73

    Copyright IBM Corp., 2000, 2004. All rights reserved. Page 58 of 73

    Now that you have completed this topic, you should be able to:

    Explain the purpose of the COND parameter on anEXEC statement

    Code the COND parameter and the various CONDsubparameters on an EXEC statement

    Topic Summary

    Summary

    Unit: Coding EXEC Statements Topic: The COND Parameter

    z/OS MVS JCL Introduction

  • 7/30/2019 JCL bsico unidad 3

    59/73

    Copyright IBM Corp., 2000, 2004. All rights reserved. Page 59 of 73

    UNIT Coding EXEC Statements

    The EXEC Statement

    The EXEC Parameter Field

    Additional EXEC Parameters

    The PARM Parameter

    The COND Parameter

    The System Library

    The STEPLIB DD Statement

    Topics:

    z/OS MVS JCL Introduction

  • 7/30/2019 JCL bsico unidad 3

    60/73

    Copyright IBM Corp., 2000, 2004. All rights reserved. Page 60 of 73

    At the end of this topic, you will be able to:

    Identify the program libraries from which the programsare retrieved at the time of execution

    Define the purpose of the JOBLIB DD statement

    Code a JOBLIB DD statement on a job

    Topic Objectives

    Unit: Coding EXEC Statements Topic: The System Library

    Introduction

    z/OS MVS JCL Introduction

  • 7/30/2019 JCL bsico unidad 3

    61/73

    Copyright IBM Corp., 2000, 2004. All rights reserved. Page 61 of 73

    Program Libraries

    In a job, each job step beings with an EXEC statement that identifies a program name. In order to run theprogram in the EXEC statement, the system searches for it in program libraries.

    It will search one or more system program libraries automatically or you can direct the system to search for

    the program in a private program library.

    Unit: Coding EXEC Statements Topic: The System Library

    Concepts

    z/OS MVS JCL Introduction

  • 7/30/2019 JCL bsico unidad 3

    62/73

    Copyright IBM Corp., 2000, 2004. All rights reserved. Page 62 of 73

    Steps Involved in Invoking a Program

    When a job step requests a program, the system searches for the program in a system library namedSYS1.LINKLIB or in a list of libraries that the installation has defined in a PARMLIB member called LINKLIST.

    LINKLIST is installation dependent and can include a number of data sets with loadable programs searched

    by default.

    Once the system finds a program in the SYS1.LINKLIB or any library in LINKLIST, it invokes the program.

    If the system cannot find the program, it will generate an abnormal termination (or abend) when you try to run

    the job.

    Unit: Coding EXEC Statements Topic: The System Library

    Concepts

    z/OS MVS JCL Introduction

  • 7/30/2019 JCL bsico unidad 3

    63/73

    Copyright IBM Corp., 2000, 2004. All rights reserved. Page 63 of 73

    In the example, the programmer wanted toexecute a program called REPORT and coded

    the JCL as shown.

    The operating system searches SYS1.LINKLIB or

    LINKLIST for REPART. The error messages

    shown occur because REPORT was misspelled

    as REPART in the JCL.

    Program Libraries An Example

    //RUN31 JOB 777,CLASS=B

    //STEPA EXEC PGM=REPART

    CSV003I REQUESTED MODULE REPART NOT

    FOUND

    CSV028I JOBNAME=RUN31 STEPNAME=STEPA

    Error Message

    Unit: Coding EXEC Statements Topic: The System Library

    Concepts

    z/OS MVS JCL Introduction

  • 7/30/2019 JCL bsico unidad 3

    64/73

    Copyright IBM Corp., 2000, 2004. All rights reserved. Page 64 of 73

    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.

    The JOBLIB DD statement causes the system to

    search a private library before searching

    SYS1.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.

    Private Program Libraries

    //JOB1 JOB 776,SMITH

    //JOBLIB DD DSN=LIBRARY,

    // DISP=SHR

    //STEP1 EXEC PGM=MYPROG

    Unit: Coding EXEC Statements Topic: The System Library

    Concepts

    z/OS MVS JCL Introduction

  • 7/30/2019 JCL bsico unidad 3

    65/73

    Copyright IBM Corp., 2000, 2004. All rights reserved. Page 65 of 73

    From the code determine which library the system would search first for UTILITY.

    A. SMITHLIB private library

    B. SYS1.LINKLIB or LINKLIST

    C. USER1 private library

    Are We on Track?

    //MYJOB1 JOB 514,SMITH

    //JOBLIB DD DSN=USER1

    //STEP1 EXEC PGM=UTILITY

    Unit: Coding EXEC Statements Topic: The System Library

    Review

    z/OS MVS JCL Introduction

  • 7/30/2019 JCL bsico unidad 3

    66/73

    Copyright IBM Corp., 2000, 2004. All rights reserved. Page 66 of 73

    Now that you have completed this topic, you should be able to:

    Identify the program libraries from which the programsare retrieved at the time of execution

    Define the purpose of the JOBLIB DD statement

    Code a JOBLIB DD statement on a job

    Topic Summary

    Unit: Coding EXEC Statements Topic: The System Library

    Summary

    z/OS MVS JCL Introduction

  • 7/30/2019 JCL bsico unidad 3

    67/73

    Copyright IBM Corp., 2000, 2004. All rights reserved. Page 67 of 73

    UNIT Coding EXEC Statements

    The EXEC Statement

    The EXEC Parameter Field

    Additional EXEC Parameters

    The PARM Parameter

    The COND Parameter

    The System Library

    The STEPLIB DD Statement

    Topics:

    z/OS MVS JCL Introduction

  • 7/30/2019 JCL bsico unidad 3

    68/73

    Copyright IBM Corp., 2000, 2004. All rights reserved. Page 68 of 73

    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 DDstatements

    Code a STEPLIB statement on a job

    Topic Objectives

    Unit: Coding EXEC Statements Topic: The STEPLIB DD Statement

    Introduction

    z/OS MVS JCL Introduction

  • 7/30/2019 JCL bsico unidad 3

    69/73

    Copyright IBM Corp., 2000, 2004. All rights reserved. Page 69 of 73

    If most of the programs for a job reside inSYS1.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.

    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

    //STEP1 EXEC PGM=PROGA

    //STEPLIB DD DSN=MYLIB,DISP=SHR

    The STEPLIB DD statement can be placedanywhere in a job step but it typicallyappears after an EXEC statement.

    Unit: Coding EXEC Statements Topic: The STEPLIB DD Statement

    Concepts

    z/OS MVS JCL Introduction

  • 7/30/2019 JCL bsico unidad 3

    70/73

    Copyright IBM Corp., 2000, 2004. All rights reserved. Page 70 of 73

    Just like a JOBLIB DD statement, the STEPLIBDD 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.

    Comparison between JOBLIB and STEPLIB DD Statements

    //JOB1 JOB 777,SMITH

    //STEP1 EXEC PGM=PROGA

    //STEP2 EXEC PGM=MYPROG

    //STEPLIB DD DSN=LIBRARY,

    // DISP=SHR

    //STEP3 EXEC PGM=PROGB

    Unit: Coding EXEC Statements Topic: The STEPLIB DD Statement

    Concepts

    Continued

    z/OS MVS JCL Introduction

  • 7/30/2019 JCL bsico unidad 3

    71/73

    Copyright IBM Corp., 2000, 2004. All rights reserved. Page 71 of 73

    What if a STEPLIB and JOBLIB DD statementboth 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.

    If the system does not find the program in library

    specified by the STEPLIB DD statement, it

    searches the system libraries (SYS1LINKLIB and

    LINKLIST) next.

    If it does not find the program there, the job step

    terminates abnormally.

    Comparison between JOBLIB and STEPLIB DD Statements (contd)

    //JOB1 JOB 777,SMITH

    //JOBLIB DD DSN=USER1

    //STEP1 EXEC PGM=MYPROG

    //STEPLIB DD DSN=LIBRARY,

    // DISP=SHR

    Unit: Coding EXEC Statements Topic: The STEPLIB DD Statement

    Concepts

    z/OS MVS JCL Introduction

  • 7/30/2019 JCL bsico unidad 3

    72/73

    Copyright IBM Corp., 2000, 2004. All rights reserved. Page 72 of 73

    Now that you have completed this topic, you should be able to:

    Identify the program libraries from which the programsare retrieved at the time of execution

    Define the purpose of the JOBLIB DD statement

    Code a JOBLIB DD statement on a job

    Topic Summary

    Unit: Coding EXEC Statements Topic: The STEPLIB DD Statement

    Summary

    z/OS MVS JCL Introduction

  • 7/30/2019 JCL bsico unidad 3

    73/73

    Now that you have completed this unit, you should 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 atexecution 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 JOBLIBDD statements should be located

    Code a JOBLIB DD statement

    Unit Summary

    Unit: Coding EXEC Statements