JCL Introduction

Embed Size (px)

Citation preview

  • 8/2/2019 JCL Introduction

    1/33

    J C L

    CONTENTS

    CONTENTS...........................................................................................................................................................1

    INTRODUCTION................................................................................................................................................3

    WHATIS JCL?...............................................................................................................................................3Features of JCL.......................................................................................................................................3

    WRITINGAND RUNNINGA JCL.........................................................................................................................3User viewpoint.........................................................................................................................................3

    System viewpoint......................................................................................................................................3

    FORMATOF JCL STATEMENTS............................................................................................................................4Name field................................................................................................................................................4

    Operation field..........................................................................................................................................5Parameter field........................................................................................................................................5

    Comments field........................................................................................................................................5

    Continuation Field...................................................................................................................................5

    Parameters field........................................................................................................................................6

    JOB STATEMENT..............................................................................................................................................6

    POSITIONAL PARAMETERS...................................................................................................................................7Name........................................................................................................................................................7

    KEYWORD PARAMETERS.....................................................................................................................................7Addrspc....................................................................................................................................................7

    Class........................................................................................................................................................7

    Cond........................................................................................................................................................8Msgclass...................................................................................................................................................9

    Msglevel..................................................................................................................................................9

    Notify.......................................................................................................................................................9Prty..........................................................................................................................................................9

    Region....................................................................................................................................................10

    Restart....................................................................................................................................................10

    Time.......................................................................................................................................................10

    TYPRUN................................................................................................................................................10

    EXEC STATEMENT........................................................................................................................................12

    EXEC STATEMENT DESCRIPTION.....................................................................................................12KEYWORD PARAMETERS..................................................................................................................................13

    ACCT.....................................................................................................................................................13ADDRSPC..............................................................................................................................................13

    COND....................................................................................................................................................13

    PARM...................................................................................................................................................14

    REGION..................................................................................................................................................14

    TIME......................................................................................................................................................15

    DD STATEMENT..............................................................................................................................................16

    DATA DEFINITION STATEMENT DESCRIPTION.............................................................................16

  • 8/2/2019 JCL Introduction

    2/33

    POSITIONAL PARAMETERS .................................................................................................................................16parameter................................................................................................................................................16

    DATA.....................................................................................................................................................17

    DUMMY.................................................................................................................................................17

    KEYWORD PARAMETERS..................................................................................................................................17DCB.......................................................................................................................................................17

    DISP.......................................................................................................................................................18DSNAME................................................................................................................................................19

    LABEL...................................................................................................................................................19

    SPACE...................................................................................................................................................20

    SYSOUT.................................................................................................................................................21

    UNIT......................................................................................................................................................21

    VOLUME...............................................................................................................................................22Some Special DD Names........................................................................................................................23

    Temporary Datasets...............................................................................................................................24Backward References.............................................................................................................................24

    OTHER STATEMENTS...................................................................................................................................26

    SOME OTHERJCL STATEMENTS........................................................................................................................26

    COMMENT STATEMENT......................................................................................................................26DELIMITER STATEMENT.....................................................................................................................26

    NULL STATEMENT................................................................................................................................26

    PROCEDURES .................................................................................................................................................27

    PROC and PEND statements.................................................................................................................27Symbolic parameters.............................................................................................................................27

    PROC statement...................................................................................................................................27PEND statement....................................................................................................................................28

    Invoking Procedures.............................................................................................................................28

    JCL FREQUENTLY ASKED QUESTIONS............................................................................................... ...31

  • 8/2/2019 JCL Introduction

    3/33

    INTRODUCTION

    What is JCL?

    Job Control Language.

    An MVS system product.

    Used by system and application programmers to enter programs into the operating system inBACKGROUND EXECUTIONmode.

    Used byJOB ENTRY SUBSYSTEM(JES2 or JES3) installed on the operating system whichconsists of a base control program.

    Features of JCL

    A job consists of related job steps.

    Identified by a JOB statement.

    Can have a maximum of 255 job steps.

    A program is entered into the operating system as a job step. A job step is identified by anEXECstatement.

    A job step consists of JCL statements that

    request and control execution of a program.request the resources needed to run the program.contain data needed by the program.

    Writing and Running a JCL

    User viewpoint

    Frequently used jcls are for high level language source compilations and linkedits, sogenerally reusable with minor modifications.

    Created as a member of a PDS (usually named CNTL).

    Edit a member and either type in the jcl or modify an existing standard JCL.

    To submit it for execution, use 'SUB' from the editor or use TSO SUBMIT membernamecommand.

    On completion of execution, the user is notified.

    User may view the output listing using SDSF.

    System viewpoint

    JES is the part of MVS which manages batch jobs.

    It starts off processing the submitted jobs in a series of steps, which for JES2 are :-

    Input processing -JES reads in a job into the system and assigns a runningsequenced job number.

  • 8/2/2019 JCL Introduction

    4/33

    Conversion processing -The JES converter scans the JCL for syntax errors. If noerrors are found, creates a corresponding encoded representation. If errors exist,user gets notified.

    Execution processing -Depending on the class requested, an initiator assigned to

    that class picks up the job for execution based on certain criteria including jobpriority. The job now runs in the initiator's address space.

    Output processing- Output datasets, which include the system messages andprogram outputs like reports etc, which form part of the job log, are written to theoutput and held output spool datasets.

    Purge processing- When all processing is complete for spooled datasets on theoutput class, JES purges or deletes the output datasets associated with the job.However, held output datasets are to be explicitly purged.

    JES3 additionally controls all resource allocations to a job.

    Format of JCL Statements

    Consists of 80 byte records

    72 73-80

    //name$operation$parameter$comments...| optional

    |

    continuation

    column

    $ refers to one or more blanks

    Examples:-

    //MYJOB JOB (PROJ,TRG,TRG,T1,TX000)//MYJOB EXEC PGM=MYPROG//STEP1 EXEC PGM=IDCAMS AMS PROGRAM

    Name field

    Identifies a particular statement so that other statements and the system canrefer to it.

    Must begin in column 3.

    Name is 1 through 8 alphanumeric or national($,#,@) characters.

  • 8/2/2019 JCL Introduction

    5/33

    First character must be alphabetic or national($,#,@).

    Examples:-//MYJOB

    //@TESTJOB//$STEP001//STEP$1

    Operation field

    Specifies the type of control statement.

    Follows the name field.

    Must be preceded and followed by a blank.

    Examples:-

    //MYSTEP EXEC PGM=MYPROG

    //MYFILE DD SYSOUT=*

    //PROCONE PROC

    Parameter field

    Follows the operation field.

    Contains parameters separated by commas.

    Must be preceded and followed by at least one blank.

    Comments field

    To be preceded by at least one blank

    To continue this across multiple lines, code a // in columns 1 and 2 of the following statementand start comments from column 16 of this statement.

    //STEP1 EXEC PGM=PGM001 A TEST PGM

    Continuation Field

    Optionally, code a non blank character in column 72 for continuing a statement across multiple lines.

    72//IFILE DD DSN=TRG1T.PROJ.SOURCE, X// SPACE=(CYL,(10,5),RLSE),// UNIT=TEMPDA,// DCB=(RECFM=VB,LRECL=80,BLKSIZE=3200)

  • 8/2/2019 JCL Introduction

    6/33

    Parameters field

    This field consists of two types of parameters -

    Positional parameters

    Appear in a pre-determined sequence.

    Separated by commas.

    Omitted parameters indicated by commas.

    No comma to be coded if all the following positional parameters are omitted oronly keyword parameters follow.

    Installation dependent.

    Examples:-//MYJOB JOB (PROJ,TRG,TRG10,N1,BATCH),'PGM1'

    //STEP1 EXEC PGM=MYPROG

    //MYFILE DD DSN=TRG1T.SRC,DISP=NEW,// SPACE=(CYL,(5,2,1))

    Keyword parameters

    Predetermined words or keywords used.

    Follows the list of positional parameters.

    Any sequence is permitted, separated by commas.

    Format =

    Examples:-//MYJOB JOB (PROJ,TRG,TRG10,N1,BATCH),'PGM1',

    // MSGCLASS=X,NOTIFY=TRGG10,TYPRUN=SCAN

    JOB STATEMENT

    The JOB statement is used to

    Mark the beginning of a job.

    When jobs are stacked in the input stream, the JOB statement marks the end of the precedingjob.

    Tell the system how to process the job by coding parameters like accounting information,programmer id, requested time, region size, class etc.

    Examples :-

    //MYJOB JOB (PROJ,TRNG),'JOB1',CLASS=A,TIME=(,50)

    //MYJOB JOB (PROJ,TRG,TRG10,N1,BATCH),'JOB',

    // CLASS=A,TIME=2,MSGLEVEL=(1,1),MSGCLASS=X,

    // NOTIFY=TRGC01,TYPRUN=SCAN

  • 8/2/2019 JCL Introduction

    7/33

    //MYJOB JOB (PROJ,TRNG,ACCT),'JOB2',CLASS=A,

    // MSGCLASS=X

    Positional Parameters

    Accounting Information

    Required by an installation in a certain format.All/some may be omitted.Consists of a list of positional parameters.

    Name

    Used for programmer or program identification.Used to identify the person or group responsible for a job.Should be twenty characters or less.

    Special character(') must appear as consecutive single-quotes.

    Examples :-//delta JOB 'g.m.hill'

    //app JOB 't.o.''neill'

    Keyword Parameters

    Addrspc

    Used to indicate to the system that the job requires virtual storage (which is pageable) orcentral storage (also called real storage, which is non-pageable).

    Used in conjunction with REGION parameter.Syntax :-

    ADDRSPC = {VIRT | REAL}-----

    Default value is VIRT

    Class

    Used by the job scheduler to assign the job to a class.

    A single alphanumeric character (A-Z,0-9) - default value is A.

    An installation may define a class as HELD(hold a job assigned to this class until operatorreleases it), or based on the maximum CPU time a job may use

    For Example :-In some installation, maximum CPU times for various classes can be

  • 8/2/2019 JCL Introduction

    8/33

    class A - 2 secs, class B - 7 secs , class C - 25 secs, class D - 70 secs , class E - 10 min ,class T - 5 min (for tapes only) , class R - 5 min (for cartridges only) etc.,

    Cond

    Used to build a mechanism for conditional execution of each job step in relation to thecondition codes of the previous job steps.

    More than one condition may be specified.

    When specified in the JOB statement, before and after each job step is executed, the systemperforms the COND parameter tests against the return codes from completed job steps. Ifnone of these tests is satisfied, system executes the job steps. Else, all remaining job steps arebypassed and job gets terminated. Note that bypassinga step is not the same as abnormaltermination of a job step.

    Recommended that use IF/THEN/ELSE/ENDIF statement construct rather than CONDparameter.

    Syntax

    COND = (code, operator)...

    Code

    Specifies the number system compares to return codes from all previous job steps in the job.Specify a decimal number from 0 to 4095.

    Comparison operators

    GT - Greater than GE - Greater than or equal toEQ - Equal to NE - Not equal toLT - Less than LE - Less than or equal to

    Summary of COND parameters-------------------------------------------------------------

    COND parameter Return Code (RC) from just completed step

    test Continue job if Terminate job if

    -------------------------------------------------------------

    COND = (code, GT) RC >= code RC < code

    COND = (code, GE) RC > code RC = code

    COND = (code, NE) RC = code RC = code

    -------------------------------------------------------------

    Examples:-COND = (7, LT)

    Any return code less than or equal to 7 allows the job to continue.

    COND = ((20,GE),(30,LT))Any return code of 21 through 30 allows the job to continue.

  • 8/2/2019 JCL Introduction

    9/33

    Msgclass

    Used to assign the job log, jcl list, system messages list etc. to an output class.Single alphanumeric character (A-Z,0-9). Default value is A

    Example:-MSGCLASS = X

    Msglevel

    Used to control listing of the job log. The system may be requested to print the following:-

    Only the JOB statement.

    All the JCL statements and any JES statements.

    Expanded procedure statements for any procedure a job step calls.

    Messages about job control statements, allocation of devices and volumes, execution andtermination of job steps and disposition of datasets.

    Syntax

    MSGLEVEL = (statement, messages)Statement sub-parameter indicates which JCL statements to print as part of the log.

    0 - Only the JOB statement.1 - All JCL statements, JES control statements and expanded procedures2 - Only JCL and JES control statements.

    Messages sub-parameter indicates which messages the system is to print in the job log.

    0 - Only JCL messages. No allocation messages.1 - All JCL, JES, operator and allocation messages.

    ExamplesMSGLEVEL = 0MSGLEVEL = (2,1)MSGLEVEL = (1,1) ---- Our installation default

    Notify

    Used to request the system to send a message to the specifiedTSO/E userid when this background job completes processing.

    SyntaxNOTIFY = userid

    Prty

    Used to assign a selection priority to a job.

    Within JES, system selects jobs for execution in order by priority.

    Depending on the installation, JES may ignore PRTY parameter.

  • 8/2/2019 JCL Introduction

    10/33

    Syntax

    PRTY = priority

    Region

    Used to specify the amount of central or virtual storage that the job requires.

    SyntaxREGION={valueK | valueM}

    Value K - specifies the required storage in Kilo-bytes. Value is 1through 7 decimal numbers, from 1 through 2096128. Code a multiple of 4.Value M - specifies required storage in Mega-bytes. The value is 1through 4 decimal numbers, from 1 through 2047. For example, REGION=3M.

    Restart

    Used to indicate the step, procedure step or checkpoint at which the system is to restart a job.

    SyntaxRESTART=STEPNAME

    Time

    Used to specify the maximum length of time that a job is to use the processor.

    Syntax

    TIME = (MINUTES, SECONDS)

    where MINUTES

  • 8/2/2019 JCL Introduction

    11/33

    TYPRUN=HOLD - Request the system to hold the job before execution till the operator releases it.TYPRUN=SCAN - Request that a scan of this job's JCL for syntax errors, without actual execution, bedone.TYPRUN=RUN - Default Type.

    JOB CARD FORMAT//JOBNAME JOB (ACCOUNTING INFO),// (PROGRAMMER NAME),// TIME=(MINUTES,SECONDS),// CLASS=A,MSGCLASS=A,PRTY=14,// REGION=NK,MSGLEVEL=(A,B),// COND=(N,OPERATOR),// TYPRUN=SCAN

    Examples.1.//FIRSTJOB JOB(PROJ,TRG,3,,123),PROGRAM1,

    // TIME=(3,10),CLASS=A,MSGCLASS=X,PRTY=5,

    // REGION=9K,MSGLEVEL=(1,1),COND=(0,NE)

    2.//SECONJOB JOB(PROJ,TRG,5),PROGRAM2,MSGCLASS=A,// CLASS=X,MSGLEVEL=(1,1)

    3.//THIRDJOB JOB(PROJ,TRG,3),PROGRAM3,TYPRUN=SCAN,// CLASS=A

  • 8/2/2019 JCL Introduction

    12/33

    EXEC STATEMENT

    EXEC STATEMENT DESCRIPTION

    The EXEC statement is used to

    Mark the beginning of each step in a job or procedure.stream, the JOB statement marks theend of the preceding job.

    Used to identify the program or procedure (cataloged or in-stream) that this job step is toexecute.

    Syntax :-//STEPNAME EXEC {PGM=program-name |

    PROC=proc-name |proc-name}

    NAME

    Optional. But if used, should be unique within the job, including stepnames in any procedurescalled by the job.

    Required in case of references to this step in later job steps.

    Required if performing a checkpoint restart at or in the step.

    Must begin in column 3.

    alphanumeric or national ($,@) characters.

    First character to be non-numeric.

    Stepname to be followed by at least one blank.

    OPERATION

    Consists of the characters EXEC and must be preceded and followed by at least one blank.

    OPERAND

    Must contain one of the positional parameters PGM, PROC or procedure name.

    Positional parameters to precede all keyword parameters.

    // EXEC

    //STEP2 EXEC PGM=PGM1//STEP3 EXEC PROC=MYPROC//STEP4 EXEC MYPROC

  • 8/2/2019 JCL Introduction

    13/33

    Keyword Parameters

    ACCT

    Used to specify one or more subparameters of accounting information that apply to this step.

    //STEP1 EXEC PGM=WRITER,ACCT=(1417,J318,'D58/920',

    // 'CHG=2','33.95')

    ADDRSPC

    Used to indicate to the system that the job step requires pageable VIRTUAL storage or non-pageable central/real storage.

    JOB statement ADDRSPC parameter applies to all steps of the job and overrides any EXEC

    statement ADDRSPC parameters. Syntax similar to the JOB statement ADDRSPC.

    COND

    Used to specify return code tests system is to use to determinewhether to execute or bypass this step. The system performs each CONDparameter test against the return code from every previous job step that executedor the named job step; if any test is satisfied, the system bypasses the step.An EXEC statement COND parameter is used instead of a JOB statementCOND parameter when you want to

    Specify different tests for each job step.

    Name a specific step whose return code the system is to test.

    Specify special conditions for executing a job step.

    Bypass only one step. When a step is bypassed because of a JOB CONDparameter, all following steps in the job are bypassed.

    Syntax

    COND=(CODE, OPERATOR, STEPNAME) (EVEN | ONLY)Code and operator sub-parameters same as in case of the corresponding Job statement sub-parameters.

    StepnameIdentifies the EXEC statement of a previous job step that issues thereturn code to be used in the test.

    EVENSpecifies that execute this job stepEVEN IFa preceding job step abnormally terminated.

    The system

  • 8/2/2019 JCL Introduction

    14/33

    Does not test the return code of any steps that terminated abnormally.Tests the return code of steps that terminated normally. If none ofthe return codes is satisfied, the step is executed.

    ONLYSpecifies that execute this job step

    ONLY IFa preceding job step abnormally terminated.

    The system

    Does not test the return code of any steps that terminated abnormally.Tests the return code of steps that terminated normally. If none ofthe return codes is satisfied, the step is executed.

    //STEP1 EXEC PGM=PGM2,COND=((24,LE),(16,EQ,S1))Step1 gets bypassed if

    Any preceding step returns a code of >= 24Step S1 returns a code = 16

    //STEP2 EXEC PGM=PGM3,COND=((16,GE),(90,LE,STEP1),ONLY)Step gets executed only if

    A preceding step abnormally terminated andThe return codes from all preceding steps are 17 or greaterThe return code from STEP1 is 89 or less.

    PARM

    Used to pass variable information to the processing program executed by this job step.

    To use this information, the program must contain instructions to retrieve this information.

    If more than one sub-parameter, enclose the sub-parameters in parantheses or apostrophes.

    Maximum of 100 characters may be passed as parameters, excluding any enclosingparantheses or apostrophes, but including any commas.

    Examples:-//STEP1 EXEC PGM=MYPROG,PARM=1200RS//STEP2 EXEC PGM=MYPROG,PARM='12.00RS'//STEP3 EXEC PGM=WORK,PARM=(DECK,LIST,'LINECNT=80',

    // '12+80',NOMAP)

    REGION

    Syntax:-

    REGION = { value K | value M }

  • 8/2/2019 JCL Introduction

    15/33

    Specifies the amount of space in kilobytes or megabytes required by this step.

    value K : specifies required storage in kilobytes. The value is1 through 7 decimal numbers, from 1 through 2096128. Generally a multiple of 4.

    value M : specifies required storage in megabytes. The value is 1 through 4decimal numbers, from 1 through 2047.

    TIME

    Specifies the maximum processor time that a job step is to use.

    Syntax similar to the JOB statement TIME parameter.

    For a JOB statement TIME parameter other than TIME=NOLIMIT or TIME=1440, thesystem sets the time limit for each step to

    The step time limit specified on the EXEC statement TIME parameter or the job timeremaining after execution of previous job steps, whichever is smaller.

    If no EXEC TIME parameter was specified, (1)the default time limitor (2)the job time remaining after execution of previous steps, whichever is smaller.

    Examples:-//FIRST JOB (ACCT),TIME=2//STEP1 EXEC PGM=PGMONE,TIME=1//...//...//STEP2 EXEC PGM=PGMTWO,TIME=1

    In this job, each step gets a maximum CPU time of 1 minute.

    //FIRST JOB (ACCT),TIME=3//STEP1 EXEC PGM=PGMONE,TIME=2//...//...//STEP2 EXEC PGM=PGMTWO,TIME=2

    In this job, STEP1 gets a maximum CPU time of 2 minutes and STEP2gets a maximum CPU time of 1 minute.

  • 8/2/2019 JCL Introduction

    16/33

    DD STATEMENT

    DATA DEFINITION STATEMENT DESCRIPTION

    The DD statement is used to

    Describe a dataset and to specify the input and output resources needed for the dataset.

    Map a logical file used by the processing program to a physical dataset.A DD statement has to be coded for every file being used by the processing program.

    Syntax:-//ddname DD operandsNAME

    Each ddname should be unique within the job step. The ddname must begin in column 3.

    The ddname is 1 through 8 alphanumeric or national ($,#,@) characters.

    The ddname must be followed by atleast one blank.

    The ddname is omitted if it defines a dataset that is to be concatenated to the dataset of thepreceding DD statement.

    Special ddnames are to be used only when the facilities that these names represent to thesystem are to be used.

    JOBCATJOBLIBSTEPCATSTEPLIB

    SYSINSYSMDUMPSYSUDUMP

    OPERATION

    The operation field consists of the characters DD and must be

    preceded and followed by at least one blank.

    PARAMETERS

    Two types of parameters: positional and keyword. All parameters are optional.

    Positional Parameters

    parameter

    Used to begin an in-stream dataset. Data records immediately follow the DD * statement.

  • 8/2/2019 JCL Introduction

    17/33

    can use /*, // or a two-character delimiter specified by a DLM parameter on this DD statement.

    //DSIN DD *

    (DATA)

    //

    //inset dd *,DLM=ED

    (DATA)

    ED

    DATA

    Used to begin an in-stream dataset that contains statements with // in columns 1 and 2.

    The data records end when either /* or the two-character delimiter specified by a DLMparameter on this DD statement is encountered.

    DUMMY

    Used to specify that no device or external storage space is to be allocated to the dataset.

    No disposition processing is to be performed on this dataset.

    All I/O requests with this file are bypassed.

    //dd1 dd data

    (data)

    /*

    //dd2 dd dummy

    Keyword Parameters

    DCB

    Used to provide information concerning the Data Control Block(DCB) for a dataset.

    Prominent among the information comprising a DCB is the record formatRECFM, datasetorganizationDSORG, Logical record lengthLRECL, maximum blocklength in bytes

    BLKSIZE.

  • 8/2/2019 JCL Introduction

    18/33

    Format

    DCB=(LRECL=NN,BLKSIZE=YY,RECFM=Z,DSORG=MM)

    where

    NN - Record Length.Z - F (Fixed Unblocked), FB (Fixed blocked), V(variable unblocked),VB(variable blocked), U(Undefined record format)MM - PS(Physical Sequential), PO(Partitioned)

    DISP

    Used to describe the status of a dataset to the system and tell the system what to do with thatdataset after termination of the step or job.

    Can specify one disposition for normal termination and another for abnormal termination.

    SyntaxDISP=(current-status,normal-termination-disp, abnormal-termination-disp)

    Could code only the current-status parameter in which case parentheses are optional.

    Could code only the normal termination DISP or abnormal termination DISP.

    CURRENT STATUS PARAMETER

    NEW - indicates that a new dataset is to be created in this step.OLD - indicates that the dataset already exists and that this step requiresexclusive access of the dataset.

    SHR - indicates that the dataset already exists and that other jobs can share it,that is, use it at the same time.

    MOD - indicates that if the dataset does not exist, it is to be createdand if it already exists, and records are to be added to the end of the dataset.In either case, MOD specifies exclusive use of the dataset.

    NORMAL TERMINATION DISPOSITION PARAMETER

    DELETE - indicates that the dataset is no longer required onsuccessful completion of job step. Space available for use by anotherdataset but existing dataset not physically erased until overwritten by another dataset.

    KEEP - indicates that the dataset is to be kept on the the volume if this stepterminates normally.

    CATLG - indicates that on normal job step termination, the systemis to place an entry pointing to the dataset in the system or user catalog.

    UNCATLG - indicates that if the step terminates normally, the system is to deletethe catalog entry corresponding to this dataset and keep this dataset.

    PASS - indicates that the dataset is to be passed for use by asubsequent step in the same job.

  • 8/2/2019 JCL Introduction

    19/33

    ABNORMAL TERMINATION DISPOSITION PARAMETER

    Can use DELETE, KEEP, CATLG or UNCATLG, in the same sense, asdescribed above, but the respective actions are taken on abnormal termination of the jobstep.Cannot use PASS.

    ExamplesDISP=NEWDISP=(OLD,UNCATLG)DISP=(NEW,CATLG,DELETE)DISP=(NEW,DELETE,DELETE) - default DISP

    DSNAME

    Used to specify the name of a dataset.

    For a new dataset, the system assigns the specified name to the dataset and for an existing

    dataset, the system uses the name to locate the dataset. For an unqualified dataset name, 1 through 8 alphanumeric or national ($,#,@) characters or a

    hyphen may be used.

    The first character must be alphabetic or national.

    For a qualified dataset, each qualifier is coded like an unqualified name.

    Each qualifier of 8 characters or fewer, maximum length of the unqualified dataset name is 44characters, including periods.

    For an output tape dataset, only rightmost 17 characters are used.

    Double ampersands are used to indicate temporary dataset names.

    Can be abbreviated to DSN.

    Examples

    DSN = ALPHADSN = TRGG10.DB2.SRCDSN = &&SECOND

    LABEL

    Used to specify for a tape or Direct access dataset

    Type and contents of the label or labels for the dataset.

    If a password is required to access the dataset.

    If the system is to open the dataset only for input or output.

    The expiration date and retention period for the dataset.

    Syntax

    LABEL = (Dataset-sequence-number,label-type,PASSWORD | NOPWREAD,IN | OUT,RETPD=nnn |EXPDT = (yyddd|yyyy/ddd)

  • 8/2/2019 JCL Introduction

    20/33

    Dataset Sequence number - identifies the relative position of a dataset on a tape/cart volume.Should be 1 through 4 decimal digits.

    Omit this parameter if access is being made to the first dataset on the tape volume.

    Label - indicates the label type of the tape/cart volume.

    SL - indicates that a dataset has IBM standard labels. Default value.NL - indicates that a tape dataset has no labels.NSL - indicates that a tape dataset has nonstandard labels.SUL - indicates that a tape dataset has both IBM standard and user labels.BLP - requests that the system bypass label processing for a tape dataset.

    PASSWORD - indicates that a dataset cannot be read, changed, deleted or

    written to unless the correct password is specified.NOPWREAD - indicates that a dataset cannot be changed, deleted or written to

    unless the correct password is specified. No password is necessary for reading the dataset.IN - indicates that a dataset opened for I/O is to be read only.

    OUT - indicates that a dataset opened for I/O is to be written only.RETPD / EXPDT - indicates the retention period and the expiration date for a dataset.

    ExamplesLABEL=(,SL)LABEL=(1,SL)LABEL=EXPDT=2012/045

    SPACE Used to request space for a new dataset.

    Can tell the system about space required and let the system assign specific tracks or can tellthe system the specific tracks to be allocated to the dataset.

    First method is most frequently used and recommended.

    SyntaxSPACE = ({TRK | CYL | blklgth}

    (,Primary-qty , Second-qty, Directory)(,RLSE)(,CONTIG)

    (,ROUND))

    TRK/CYL - Requests that space be allocated in tracks or cylinders.

    Blklgth - Specifies the average block length, in bytes, of data.Specify a decimal number from 1 through 65535. This takes precedence,when specified, together with the BLKSIZE field of DCB parameter.

    Primary-qty - Specifies the amount of primary space required in

  • 8/2/2019 JCL Introduction

    21/33

    terms of the space unit (tracks/cylinders/number of data blocks).One volume must have enough space for the primary quantity. If aparticular volume is requester and it does not have enough spaceavailable for the request, the job step is terminated.

    Second-qty - Specifies the number of additional tracks, cylinders,blocks to be allocated, if additional space is required.

    Directory - Specifies the number of 256-byte records needed in the directory of a PDS.

    RLSE - requests that space allocated to an output dataset, but notused, is to be released when the dataset is closed. Release occurs onlyif dataset is open for output and the last operation was a write.

    CONTIG - requests that space allocated to the dataset must be contiguous.Affects only primary space allocation.

    ROUND - When the first parameter specifies the average block length, this parameter requeststhat allocated space must be equal to an integral number of cylinders. Else ignored.

    ExamplesSPACE=(CYL,10)SPACE=(1024,75)SPACE=(TRK,(50,10,5))SPACE=(TRK,(100),RLSE)SPACE=(CYL,(10,,10),,CONTIG)

    SYSOUT

    Used to identify this dataset as a system output dataset. Assign this sysout dataset to anoutput class. The attributes for each class are defined during JES initialization,including device or devices for the output class

    Syntax

    SYSOUT=(class-name | *)When SYSOUT=* is coded, the SYSOUT class is the same as the MSGCLASS parameter of the JOB

    statement.Examples//MYOUT DD SYSOUT=A//REFFILE DD SYSOUT=*

    UNIT

    Used to ask the system to place the dataset on

    A specific device

    A certain type or group of devices.

    The same device as another dataset.

  • 8/2/2019 JCL Introduction

    22/33

    SyntaxUNIT=((device-number | device-type | group-name)

    (,unit-count | P)(,DEFER))

    ORUNIT=AFF=ddname

    device-number - identifies a particular device by a 3-character hexadecimal number.Should not be used unless absolutely necessary.

    device-type - Requests a device by its IBM supplied generic name. (Eg. 3380, 3390)

    group-name - Requests a group of devices by its symbolic name.Installation must have assigned the name to the device(s) during system initialization.The group-name is 1 through 8 alphanumeric characters (Eg. TEMPDA)

    unit-count - Specifies the number of devices for the dataset.A decimal number from 1 to 59.

    P - asks the system to mount all volumes for a dataset in parallel.

    DEFER - Asks the system to assign the dataset to the device butrequests that the volume(s) not be mounted until the dataset is opened.

    DEFER is ignored for a new dataset on direct access.AFF=ddname - Requests that system allocate different datasets residing on differentremovable volumes to the same device during step execution.The ddname is that of an earlier DD statement in the same step.Reduces number of devices used in a job step.

    ExamplesUNIT=3380

    UNIT=SYSDAUNIT=(TAPE,,DEFER)UNIT=AFF=DD1

    VOLUME

    Used to identify the volume(s) on which a dataset resides or will reside. The requests could be

    A private volume

    Retention of the volume

    A specific volume by serial number

    The same volume that another dataset uses.

    Can be abbreviated as VOL.

    SyntaxVOLUME = ((PRIVATE)

    (,RETAIN)(,volume-sequence-number)(,volume-count))(SER=serial-number1,

    serial number2......)

  • 8/2/2019 JCL Introduction

    23/33

    PRIVATE - Requests a private volume. When private, the system isnot to allocate an output dataset to the volume unless specificallyrequested, and for demountable devices, to be demounted after thedataset is closed, unless RETAIN is also coded.

    RETAIN - Requests that volume is not to be demounted or rewoundafter the dataset is closed or at the end of this step. Useful whena following step is to use the same volume.

    volume-sequence-number - identifies the volume of an existing multi volume datasetto be used to begin processing the dataset. A decimal number from 1 through 255.

    volume-count - Specifies the maximum number of volumes that anoutput dataset requires. The volume-count is a decimal number from 1 through 255.

    SER=serial-number - Identifies by serial number the volume(s) onwhich the dataset resides or will resides. 1 through 6 alphanumericor national(@,#,$) characters. Can code a maximum of 255 volume serials.

    ExamplesVOLUME=SER=DEV001VOL=(,,,3,SER=(PAGE01,PAGE02,PAGE03))VOL=(,RETAIN,,,SER=TM0255)

    Some Special DD Names

    JOBLIB

    Used to create a private library, a PDS on a DASD.

    Identify a private library that the system is to search for the program named in each EXECstatement PGM parameter in the job.

    Must be the DD statement immediately following the job card.

    When specified, system looks for each program to be executed in the datasets concatenatedunder JOBLIB before looking at the system libraries.

    STEPLIB

    Used to create a private library, a PDS on a DASD.

    Identify a private library that the system is to search for the program named in the EXECstatement PGM parameter for that step.

    Must be the DD statement immediately following the EXEC statement of the step.

    When specified, system looks for the program to be executed in the datasets concatenated

    under STEPLIB before looking at the system libraries.When both the STEPLIB and JOBLIB DD statements are coded, the system looks at the STEPLIB library

    for that step before looking at the system libraries. The system ignores JOBLIB for that step.

    SYSABEND

    Produces a dump of user and system areas.The dump is formatted so that it can be printed directly.

  • 8/2/2019 JCL Introduction

    24/33

    SYSMDUMP

    Produces a dump of system areas and program's address space.The dump is unformatted and machine-readable.To be used, the dump must be printed using Interactive problem control system (IPCS).

    SYSUDUMP

    Produces a dump of user areas. The dump is formatted so that it can be printed directly.

    SYSIN

    Used to begin an instream dataset.Instream datasets begin with DD * or DD DATA statement.

    Temporary Datasets. The DSNAME parameter has the value &&name to designate a temporary dataset.

    It must be string of alphanumeric characters of at most eight characters.

    Temporary datasets are unconditionally deleted at the end of a job

    Temporary datasets can be passed from one job step to another within a job.

    Its DISP parameter should then be DISP=(NEW,PASS).

    Only the job that creates a temporary dataset has access to it, to read and write to the datasetand to scratch the dataset.

    //TEMPFILE DD DSN=&&TEMP1,UNIT=TEMPDA,// DISP=(NEW,PASS),SPACE=(TRK,(10,10))

    Backward References.

    A backward reference is a reference to an earlier statement in the

    job or in a cataloged or in-stream procedure called by the job step.

    Many parameters in job control statements can use a backward reference to fill in information.

    *.name or *.ddname - where name or ddname is the name field of the referenced statement in thesame jobstep.

    *.stepname.name or *.stepname.ddname - where the referenced statement, name or ddname, is inan earler step, in the same job.

    *.stepname.procstepname.name or *.stepname.procstepname.ddname- Where this job step or an earlier job step, stepname, calls a procedure ; the procedure contains

    procedure step, procstepname, which contains the referenced statement, name or ddname.

    Example 1.

  • 8/2/2019 JCL Introduction

    25/33

    //STEPA EXEC ...//DD1 DD DSNAME=REPORT

    .

    .

    .//DD2 DD DSNAME=*.DD1Example 2.//STEP1 EXEC ...//DDA DD DSN=D58.POK.PUBS01

    .

    .

    .//STEP2 EXEC ...//DDB DD DSN=*.STEP1.DDA

  • 8/2/2019 JCL Introduction

    26/33

    OTHER STATEMENTS

    Some Other JCL statements

    COMMENT STATEMENT

    Used to enter a comment on the output listing.

    Used primarily to document a job and its resource requirements.

    Can be placed anywhere after the JOB card.

    //* THE COMMENT STATEMENT CANNOT BE CONTINUED//* BUT IF YOU HAVE A LOT TO SAY, YOU CAN FOLLOW A COMMENT//* STATEMENT WITH MORE COMMENT STATEMENTS.

    DELIMITER STATEMENT

    Used to indicate the end of data or transmittal records in the input stream.The characters /* in columns 1 and 2 serve as the delimiter statement.The system recognizes a delimiter other than /* if a DLM parameteris coded on the DD * or DD DATA statement that defines an in-stream dataset.

    Example//STEP1 EXEC PGM=SERS//DD1 DD *

    .

    .DATA.

    /* END OF DATA FOR DATASET DD1//DD2 DD DATA,DLM=AA

    .DATA.

    AA END OF DATA FOR DATASET DD2

    NULL STATEMENT

    Used to mark the end of a job.Consists of characters // in columns 1 and 2. The rest of the statement must be blank.It is placed at the end of a job's control statements and data and at the end of an input stream.

    Example//STEP1 EXEC PGM=XTRACT//DD1 DD *

    .

    .DATA.

    /*//

  • 8/2/2019 JCL Introduction

    27/33

    PROCEDURES

    PROC and PEND statements

    For jobs that are to be run frequently (eg. compile, link-edit) put them as part of a procedure.

    A procedure can be placed in the same job stream as the procedure invocation. Suchprocedures are called Instream procedures.

    Such procedures are prepared, tested and catalogued as part of a PDS called procedure library.SYS1.PROCLIB is the system procedure library. These are called catalogued procedures.

    Procedures save jcl coding time and prevent jcl errors.

    Parameters can be passed to procedures.

    Can also specify default parameters for use in a procedure.

    Begin with a PROC statement or an EXEC statement.

    EXEC, DD and comment statements can be placed in a procedure.

    DD statements defining private libraries to be used throughout the job (JOBLIB) not to becoded in instream or catalogued procedures.

    DD statements defining instream datasets not to be coded in procedures.

    Delimiter and Null statements not to be used in procedures.

    Symbolic parameters

    In order to be modified easily, the JCL statements in a procedure can contain SymbolicParameters. A symbolic parameter can stand as a symbol for any information in the parameterfield of a statement, a parameter, a sub-parameter or a value.

    Any parameter, sub-parameter, or value in a JCL statement that can vary each time the job isexecuted is a good candidate to be coded as a symbolic parameter.

    Symbolic parameter names can be 1 through 7 alphanumeric or national characters.

    Defaults may be specified for symbolic parameters.

    They may be overridden when procedures are invoked.

    Examples:-//S1 EXEC PGM=&PGM//DD1 DD DSN=PMRD.LIB.COBOL(&MEM)

    PROC statement

    Used to mark the beginning of a procedure.

    Syntax//name PROC parametersName

    A name is required on a PROC statement in an in-stream procedure and is optional on aPROC statement in a catalogued procedure.

    When coded for instream procedures, must be unique within the job.

    For catalogued procedures, name need not be unique, but the procedures which are identicallynamed should be in different procedure libraries.

    If coded, name should begin in column 3, must be 1 through 8

  • 8/2/2019 JCL Introduction

    28/33

    alphanumeric or national ($,#,@) characters.

    First character should not be numeric.

    Followed by at least one blank.Operation field

    Consists of characters PROC and must be preceded and followed by at least one blank.Parameter field

    When coded with PROC statement, parameters on a PROC statementassign default values to symbolic parameters on procedure statements.An in-stream procedure requires parameters only if the procedure contains symbolic parameters.

    PEND statement

    Used to mark the end of an instream procedure.A catalogued procedure may be ended using a PEND statement, but it is not required.

    Syntax//name PEND commentsName

    Must be unique for an in-stream procedure within a job.For a catalogued procedure, this is not essential.If coded, name must begin on column 3.Must be 1 through 8 alphanumeric or national($,@,#) characters.First character to be non-numeric. To be followed by atleast one

    Operation

    Consists of characters PEND and must be preceded and followed by at least one blank.Comments

    Follow PEND after at least one intervening blank.

    Invoking Procedures.

    Cataloged or Instream procedures can be invoked by using an EXEC statement.Parameters in the EXEC or DD statements can be modified, added or deleted when invoking a

    procedure.

    Syntax//stepname EXEC PROC=procedure-name

    OR//stepname EXEC procedure-nameExample of an in-stream procedure

  • 8/2/2019 JCL Introduction

    29/33

    //JOB1 JOB ...//PROC1 PROC,DSN='TRGG10.SRC.COBOL'//PSTEP1 EXEC PGM=QMR401//PDD1 DD DSN=&DSN(&MEM),...

    .

    .// PEND//STEP1 EXEC PROC1,DSN='TRG1T.SRC.COBOL',MEM=COB1//PROC2 PROC

    .

    .

    .// PEND//STEP2 EXEC PROC=PROC2//STEP3 EXEC PGM=QMR402//STEP4 EXEC PROC=PROC1,MEM=COB1

    Example of a catalogued procedure

    //JOB1 JOB ...//STEP1 EXEC PROC=P,MEM=COB1,DISP=SHR

    .//STEP2 EXEC Q

    .//In SYS1.PROCLIB member P://PS1 EXEC PGM=R15//DD1 DD SYSOUT=*

    .

    .//DD5 DD DSN=TRGC10.COBOL(&MEM),DISP=&DISPIn SYS1.PROCLIB member Q:

    // PROC//PSTEP1 EXEC PGM=WRIT2//OUTDS DD SYSOUT=*

    Parameters in an EXEC or DD statement in a procedure can be modified , added or deleted wheninvoking a procedure DD statements appearing in a procedure may be changed, added ordeleted when invoking a procedure.Any DD statements to be added are to be coded only after coding for all the DD statements whichneed to be changed has been done.

    Overriding symbolic parameters

    Syntax

    parameter.procedure-stepname=new-valueOverriding DD statements.

    Syntax//procedure-stepname.ddname DD .....

  • 8/2/2019 JCL Introduction

    30/33

    ExampleA Catalogued procedure P1

    //P1 PROC//S1 EXEC PGM=COBCOMP,REGION=256K//DD1 DD DSN=TRGC10.SRC.COBOL(COB1),DISP=SHR//DD2 DD DSN=TRGC10.TEST.LOAD(COB1),DISP=SHR

    .

    .

    .//S2 EXEC PGM=PGM2

    .

    .

    .//S3 EXEC PGM=PGM3,TIME=(,3)

    Invocation

    //STEP1 EXEC P1,REGION.S1=1024K,// REGION.S2=512K,TIME.S3=(1,5)//S1.DD2 DD DSN=TRG1T.TEST.LOAD(COB1),DISP=SHR//S3.SYSABEND DD SYSOUT=*

    Upto 15 instream procedures can be coded in a single job.An in-stream procedure cannot be defined within another procedure or nested.Cataloged and in-stream procedures can invoke other procedures (upto 15 levels of nesting).In a procedure, an EXEC statement may invoke another procedure, which contains an EXECstatement to invoke another procedure, and so on.

  • 8/2/2019 JCL Introduction

    31/33

    JCL FREQUENTLY ASKED QUESTIONS

    Q: I get the error message "Bad Job Card".

    A: Check the spacing in your job card. The common error is not to leave a space beforeand after the word "JOB".

    Q: I get the error message bad continuation.

    A: Two common errors cause this message. First make sure you have a // in the first twocolumns

    Second if you are using DISP=OLD without going to a new line make sure the linelooks like

    DSN=MYCATLOG.YOURFILE,DISP=OLD. If you typeDSN=MYCATLOG.YOURFILE,DISP=OLD with a space you get a continuation error every time.

    Q: I get an error on a line with brackets.

    A: It may not look clear on the handouts but use ( ) and not on the job card

    Q: When I click on the PROXMVS icon with my disk inserted I see the disk being

    accessed and then I am back to the icon or else I have an error message. In any case I

    can't get to my files and I'm worried that my files are gone forever.

    A: First, relax while you read this answer. All is not lost! This problem falls into twomain categories: disk problems and catalog problems. FIRST, a disk problem can occur ifyou walked by a super conducting magnet or a bulk tape eraser, reformatted the disk, sat onthe disk, left the disk to boil in the sun in your car, etc. Physical damage to the disk is

    difficult to recover from and that is why I if I help you in the lab you will get tired of mesaying "have you backed up your disk?" by the end of the term. If you backed up your diskthen the most you have lost is probably the current assignment. In fact I suggest you backup to your home hard drive or a spare floppy after every assignment. In case only dust gotinside the disk you can slide open the metal covering and blow on the disk as you rotate it,being careful not to get moisture on the disk. That is about the extent of recovering from aphysical disk problem. The SECOND and most common problem is that of a corruptedmaster catalog. Go to Windows File Manager and verify that your files are in theA:\mycatlog directory. You should see assgn1.dat, assgn2.dat, etc. If this is the case thenat this point make a backup of your disk in case anything goes wrong. You may nowgenerate your disk just as you did when the course started. A new and EMPTY master

    catalog will be created. Then start PROXMVS from the windows icon and select theUtilities menu. In Utilities you will see a function called Catalog Dataset. When you clickon this option you will enter in mycatlog/assgn1 and press enter and a menu similar to theallocate menu will come up. Fill in this menu just as you would if you were allocating anew dataset and be sure to type the name in again at the bottom of the screen asmycatlog/assgn1. When you press enter you should see a message saying that the datasetwas cataloged. Now try to bring up the mycatlog/assgn1 normally and if this works repeatthe procedure for each assignment. The important rule is that allocating is destructive and

  • 8/2/2019 JCL Introduction

    32/33

    recataloging is not. Recataloging allows you to put the assignment back into a mastercatalog file that the system uses to find the assignments. If you ever allocate over anassignment it is gone forever. I have tried to make these steps as clear as possible;however, if you feel uncomfortable with recataloging your files or if you don't see yourfiles in Windows File Manager then see me or the instructor.

    Q: I'd like to use a Printer Spacing Chart but they don't sell them in the bookstore

    and I can't find them anywhere in town. Where can I get one?

    A: You can download a 132 COLUMN PRINTER SPACING CHART here by clicking onthe hyperlinked text. I designed the chart in Microsoft Excel. If you have Excel on yourhome system you can click on the file and it should open in Excel and allow you to print it;otherwise, you can print it out at the UWF Computer Lab.

    Q: What is the name of the program that you use to delete an existing dataset

    through a JCL job step?

    A: IEFBR14.

    Example: //DELETE JOB (2215,15),'DELETE',CLASS=A// EXEC PGM=IEFBR14//X DD DSN=TEST.DATA,DISP=(OLD,DELETE)

    Q: What is are optimum suggested blocksizes?

    A: For data records, the suggested blocksize is 6160:DCB=(RECFM=FB,LRECL=80,BLKSIZE=6160)

    If the record length (LRECL) isn't 80, choose some multiple of it that results in ablocksize close to 6200, but under 6233.

    For text records, the suggested blocksize is 6233:

    DCB=(RECFM=VB,LRECL=255,BLKSIZE=6233)

    Q: How does COND parameter determines the execution of a job step?

    A:-------------------------------------------------------------

    COND parameter Return Code (RC) from just completed step

    test Continue job if Terminate job if

    -------------------------------------------------------------

    COND = (code, GT) RC >= code RC < code

    COND = (code, GE) RC > code RC = code

    COND = (code, NE) RC = code RC = code

    -------------------------------------------------------------

  • 8/2/2019 JCL Introduction

    33/33

    Q: What is the maximum time limit for job that can be specified in the job card?

    A: Syntax

    TIME = (MINUTES, SECONDS)

    where MINUTES