Jcl Slides Day 2

Embed Size (px)

Citation preview

  • 8/4/2019 Jcl Slides Day 2

    1/80

    EXEC STATEMENT

    Overview

  • 8/4/2019 Jcl Slides Day 2

    2/80

    EXEC STATEMENT

    EXEC statement defines thebeginning of a step in a job or aprocedure.

    An EXEC statement is required foreach job step.

    Maximum of 255 steps (EXECstatements) in a single job.

    Stepnames follow the same rules forall names in JCL:

    1-8 characters in length(alphanumeric or national(#,@,$)).

    First character must be alphabetic ornational.

    Must be followed by at least oneblank.

  • 8/4/2019 Jcl Slides Day 2

    3/80

    EXEC STATEMENT SYNTAX

  • 8/4/2019 Jcl Slides Day 2

    4/80

    PROGRAM EXECUTION

    By default, SYS1.LINKLIB

    issearched forthe

    programto beexecuted.

  • 8/4/2019 Jcl Slides Day 2

    5/80

    TIME PARAMETER

  • 8/4/2019 Jcl Slides Day 2

    6/80

    TIME-EXAMPLE

  • 8/4/2019 Jcl Slides Day 2

    7/80

  • 8/4/2019 Jcl Slides Day 2

    8/80

    REGION Parameter

    Specifies amount of storage

    space required to execute the

    step

    Formats are:

    REGION=K

    REGION=M

    should be a positive

    numeric in units of K or M

    indicating Kilobytes or

    Megabytes of space

    If omitted, a default value is

    assigned by the system

  • 8/4/2019 Jcl Slides Day 2

    9/80

    COND Parameter

    On completion of each step, a return-code is generated.This return-code can be checked and based on this a stepcan be bypassed or executed. This is done using the CONDparameter

    Formats are:

    COND=(, ) COND=(, ,

    )

    COND=EVEN

    COND=ONLY

    is a positive number from 0 to 4095

    specifies the type of comparison tobe made with the return-code of a previous step and canbe one of GT,LT,GE,LE,EQ,NE

    is the name of a prior executed step

  • 8/4/2019 Jcl Slides Day 2

    10/80

    COND Parameter

    In the visual, examine thecondition codes set in STEP2 andSTEP3

    The interpretation of theCondition codes set are

    In STEP2, if the RC fromSTEP1 is less than or equal

    to 8, STEP

    2 is executed In STEP3, if the RC from

    STEP2 is equal to 4, STEP3is bypassed

    Program

    RTCODE00 in STEP1, ifexecuted, returns a RC of 0

    RTCODE04 in STEP2, ifexecuted, returns a RC of 4

    RTCODE08 in STEP3, ifexecuted, returns a RC of 8

    Result is,STEP3 is bypassed asthe RC from STEP2 is 4

  • 8/4/2019 Jcl Slides Day 2

    11/80

    COND Parameter - Interpretation

    COND parametercheck Returncodefromreferred step

    Terminate JOB Execute JOB

    COND=(code,GT,step) R

    Cfromstep < code R

    Cfromstep > = code

    COND=(code,GE,step) RCfromstep code

    COND=(code,EQ,step) RCfromstep = code RCfromstep not= code

    COND=(code,LT,step) RCfromstep > code RCfromstep < = code

    COND=(code,LE,step) RCfromstep >= code RCfromstep < code

    COND=(code,NE,step) RCfromstep not= code RCfromstep = code

  • 8/4/2019 Jcl Slides Day 2

    12/80

    Example: Condition

    Parameter

  • 8/4/2019 Jcl Slides Day 2

    13/80

  • 8/4/2019 Jcl Slides Day 2

    14/80

  • 8/4/2019 Jcl Slides Day 2

    15/80

  • 8/4/2019 Jcl Slides Day 2

    16/80

  • 8/4/2019 Jcl Slides Day 2

    17/80

    EVEN and ONLY Condition Codes

    COND=EVEN executes the step, even if any preceding steps have

    ended abnormally

    COND=ONLY executes the step, only if any preceding steps have

    ended abnormally

  • 8/4/2019 Jcl Slides Day 2

    18/80

    Example: Condition

    Parameter for EVEN AND

    ONLY

  • 8/4/2019 Jcl Slides Day 2

    19/80

  • 8/4/2019 Jcl Slides Day 2

    20/80

  • 8/4/2019 Jcl Slides Day 2

    21/80

  • 8/4/2019 Jcl Slides Day 2

    22/80

  • 8/4/2019 Jcl Slides Day 2

    23/80

  • 8/4/2019 Jcl Slides Day 2

    24/80

    DD STATEMENT

    OVERVIEW

  • 8/4/2019 Jcl Slides Day 2

    25/80

    DD STATEMENT

    The DD statementisused todescribea datasetand specify

    theinputand outputresources

    needed forthe dataset.

    A DD statementisnormally

    required foreach datasetthatis

    to be processed inastep.

    All DD statementsforasingle

    step mustfollowthe EXEC

    statement.

    DD statementsforasinglestep

    canusually beinany order.

  • 8/4/2019 Jcl Slides Day 2

    26/80

    Why DD ?.

  • 8/4/2019 Jcl Slides Day 2

    27/80

    Accessing a Data set

  • 8/4/2019 Jcl Slides Day 2

    28/80

    DD Statement

    DD statement identifies

    a data stream to a

    program

    DD statement contains

    An optional DD

    name

    DD operation

    field

    Positional

    parameters

    Keyword

    parameters

    UNIT

    DISP

  • 8/4/2019 Jcl Slides Day 2

    29/80

    DDNAME

    Specifiesanameforthe

    DD statement

    Muststartwithan

    alphabetand between 1to 8 alphanumericcharacters

    Mustbeginincolumn 3

    and becontinued till

    column 10

    Isconditionally optional

  • 8/4/2019 Jcl Slides Day 2

    30/80

    DSN - Keyword Parameter

    Specifies the fully qualified physical name of the input or output file

    Format is

    DD DSN= for a cataloged dataset

    DD DSN=&&temporary-dataset-name for a temporary

    dataset

    For cataloged dataset, DSN name must be a maximum of 44 character

    including periods after every 8 characters or less

    Temporary datasets start with && and are 1 to 6 characters long

  • 8/4/2019 Jcl Slides Day 2

    31/80

    Example for Creating

    Temporary Dataset

  • 8/4/2019 Jcl Slides Day 2

    32/80

  • 8/4/2019 Jcl Slides Day 2

    33/80

  • 8/4/2019 Jcl Slides Day 2

    34/80

    DISP Keyword Parameter

    Specifiestheexistingstatus (disposition) ofthe datasetand stepsto betaken

    onsuccessful/unsuccessfulexecutionofthestep

    Formatis

    DISP=(, , )

    present-statusspecifiescurrentstatus,meaningwhetherthe dataset

    existsoristo becreated and ifitexists,themodeofaccesstoit

    normal-end-statusspecifieshowtohandlethe datasetuponsuccessful

    completionofthe JOB

    abnormal-end-statusspecifieshowtohandlethe datasetuponabnormal

    terminationofJOB

    Defaultvaluesare DISP=(NEW,DELETE,DELETE) fornew datasetand

    DISP=(OLD,KEEP,KEEP) forexisting dataset

  • 8/4/2019 Jcl Slides Day 2

    35/80

    DISP Keyword Parameter

    DISP=(, , )

    Oneormoresub parameterscan beomitted butatleastoneshould becoded

    Sub parametersare positionalinnature

    Ifonly iscoded, paranthesescan beomitted

    Ifthe field isomitted and the and

    arecoded,then paranthesesarerequired and comma

    should becoded beforethesub-parameters

  • 8/4/2019 Jcl Slides Day 2

    36/80

    Example Program :

    DISP(NEW,DELETE,DELETE)

  • 8/4/2019 Jcl Slides Day 2

    37/80

  • 8/4/2019 Jcl Slides Day 2

    38/80

  • 8/4/2019 Jcl Slides Day 2

    39/80

    Example Program :

    DISP(NEW,KEEP,DELETE)

    EXAMPLE

  • 8/4/2019 Jcl Slides Day 2

    40/80

  • 8/4/2019 Jcl Slides Day 2

    41/80

  • 8/4/2019 Jcl Slides Day 2

    42/80

    Example Program :

    DISP(NEW,PASS,DELETE)

  • 8/4/2019 Jcl Slides Day 2

    43/80

  • 8/4/2019 Jcl Slides Day 2

    44/80

    DATA SETWILL NOT BE RETAINED

  • 8/4/2019 Jcl Slides Day 2

    45/80

    Example FOR COPYING APhysical file to another

    Physical File :

    DISP(NEW,CATLG,DELETE)

    Example

  • 8/4/2019 Jcl Slides Day 2

    46/80

  • 8/4/2019 Jcl Slides Day 2

    47/80

  • 8/4/2019 Jcl Slides Day 2

    48/80

  • 8/4/2019 Jcl Slides Day 2

    49/80

  • 8/4/2019 Jcl Slides Day 2

    50/80

  • 8/4/2019 Jcl Slides Day 2

    51/80

    Example Program :

    DISP(OLD,KEEP,DELETE)

  • 8/4/2019 Jcl Slides Day 2

    52/80

  • 8/4/2019 Jcl Slides Day 2

    53/80

  • 8/4/2019 Jcl Slides Day 2

    54/80

  • 8/4/2019 Jcl Slides Day 2

    55/80

  • 8/4/2019 Jcl Slides Day 2

    56/80

    DATASETWILL BE RE-WRITTEN

  • 8/4/2019 Jcl Slides Day 2

    57/80

    Example Program :

    DISP(MOD,KEEP,DELETE

    )

  • 8/4/2019 Jcl Slides Day 2

    58/80

    Example Program:

    DISP(MOD,KEEP,DELETE

    )

  • 8/4/2019 Jcl Slides Day 2

    59/80

  • 8/4/2019 Jcl Slides Day 2

    60/80

  • 8/4/2019 Jcl Slides Day 2

    61/80

  • 8/4/2019 Jcl Slides Day 2

    62/80

  • 8/4/2019 Jcl Slides Day 2

    63/80

  • 8/4/2019 Jcl Slides Day 2

    64/80

    UNIT Keyword Parameter

    Specifiesinformationabouttheinputoroutputdevicesused by the JOB

    Someformatsare:

    UNIT=device-address

    UNIT=device-type

    UNIT=device-group-name

  • 8/4/2019 Jcl Slides Day 2

    65/80

    SPACE Keyword Parameter

  • 8/4/2019 Jcl Slides Day 2

    66/80

    SPACE Keyword Parameter

    Specifies Spacerequired toallocateanew dataseton DASD

    Formatis SPACE=(S1,(S2,S3,S4),S5,S6,S7) where

    S1 ismandatory and specifiesunitofallocation

    S2 ismandatory and specifiesthe primary quantity

    S3 isoptionaland specifiesthesecondary quantity

    S4 isoptionaland specifiesthe directory blocksused forcreatinga partitioned

    dataset

    S5 isoptionaland iscoded asRLSE

    S6 isoptionaland iscoded asCONTIG

    S7 isoptionaland iscoded asROUND

  • 8/4/2019 Jcl Slides Day 2

    67/80

    SPACE Keyword Parameter

    SPACE=(S1,(S2,S3,S4),S5,S6,S7)

    sub parameterspecifiesunitofallocation. Theunitsare:

    TRK Forallocating Spaceinunitsoftracks

    CYL Forallocating Spaceinunitsofcylinders

    forallocatingspaceinunitsofblocks; Exactly,howmany bytesof

    datawill beallocated dependsonthevaluespecified inthe DCB=BLKSIZE sub

    parameter

  • 8/4/2019 Jcl Slides Day 2

    68/80

    SPACE Keyword Parameter

    SPACE=(S1,(S2,S3,S4),S5,S6,S7)

    sub parameterspecifies primary quantity ofspacerequested

    sub parameter

    Specifiessecondary quantity ofspacewhichisallocated when primaryquantity ofspaceisinsufficient

    Secondary spacewhenallocated may notbecontiguouswith primary space

    Ifnotspecified JOB may abend

    sub parameter

    Specifiesthenumberofdirectory blocksforcreatinga Partitioned dataset

  • 8/4/2019 Jcl Slides Day 2

    69/80

    SPACE Keyword Parameter

    SPACE=(S1,(S2,S3,S4),S5,S6,S7)

    sub parameter

    SpecifiestheoptionRLSE thatindicatesthatany unused spaceallocated toa

    datasetbereleased oncethe datasetisclosed.

    Takestimetoreleasespace

    sub-parameter

    SpecifiesavalueCONTIGthatindicatesthatonly contiguousspaceshould be

    allocated tothe dataset

    Optionappliesonly to primary spaceallocation

    Resultsin decreased datasetaccesstime

    JOB abendsifrequested spaceisnotcontiguously available

    sub parameter

    SpecifiesavalueROUND

  • 8/4/2019 Jcl Slides Day 2

    70/80

    DATA CONTROL BLOCK Parameter - DCB

    Specifiestheattributesofthe dataset

    Sub parametersare:

    RECFM

    LRECL

    BLKSIZE

    DSORG

  • 8/4/2019 Jcl Slides Day 2

    71/80

    DCB - Sub Parameters

    LRECL (Stands for Logical Record Length)

    Format is LRECL=

    Specifies record length in bytes for fixed and variable length records

    For variable record lengths, the LRECL should be 4 bytes more than thelength of the largest record

    BLKSIZE

    Format is BLKSIZE=

    Specifies the block size of data in bytes

    Must be a multiple of LRECL

    For variable record lengths the BLKSIZE should be 4 bytes more than the

    length of the largest record

  • 8/4/2019 Jcl Slides Day 2

    72/80

    DCB Sub Parameters

    RECFM Specifiesrecord formatofdatasetbeingcreated

    FormatisRECFM= where can

    takeoneofthefollowingvalues

    F - Fixed

    FB - Fixed Blocked

    V - Variable

    VB - Variable Blocked

    U - Undefined

  • 8/4/2019 Jcl Slides Day 2

    73/80

    DCB Sub Parameters

    DSORGspecifiestheway datasetisorganized

    Formatis DSORG= where

    cantakeoneoffollowingvalues:

    PS for Physicalsequential

    POfor Partitioned organization

  • 8/4/2019 Jcl Slides Day 2

    74/80

    Dataset Concatenation

    Datasets can beconcatenated andconsidered as one file bythe system

    All datasets beingconcatenated must have

    the same record format All datasets being

    concatenated must exist onsame type of device

    To concatenate datasetsomit the DDname from allthe DD statements exceptthe first one

    In this visual FILE1 is aconcatenated input dataset

  • 8/4/2019 Jcl Slides Day 2

    75/80

    Special DD statements

    SYSIN

    JOBLIB

    STEPLIB

    JCLLIB

    SYSOUT

    SYSDUMP

    SYSABEND

  • 8/4/2019 Jcl Slides Day 2

    76/80

    JOBLIB

    Ifcoded,specifiesthe

    library wheretheload

    moduleofthe programto

    beexecuted will be

    searched firstinany step

    Coded immediately after

    the JOB statementelse

    resultsin JCL error

  • 8/4/2019 Jcl Slides Day 2

    77/80

    STEPLIB

    Specifiesthelibrary

    wheretheload moduleof

    the programto be

    executed will besearched

    Appliesonly tothestep

    whereitisspecified

  • 8/4/2019 Jcl Slides Day 2

    78/80

    SYSOUT

    Special DDnameused for

    listingmessageslisted outofthe DISPLAYverb used

    inCOBOL program

  • 8/4/2019 Jcl Slides Day 2

    79/80

    Dump related special DDnames

    SYSDUMP

    Formatis SYSDUMP DD

    Used toobtaina dump ofthecontentsofvariousregistersand

    variablesincaseofanabnormalend ofprogram

    Dump isinhexadecimalformat

    SYSABEND

    Formatis SYSABEND DD .

    Containssame detailsas SYSDUMP withmore details

    SYSUDUMP

    SYSMDUMP

  • 8/4/2019 Jcl Slides Day 2

    80/80

    END