Presentation is loading. Please wait.

Presentation is loading. Please wait.

JOB CONTROL LANGUAGE IDC Training Centre.

Similar presentations


Presentation on theme: "JOB CONTROL LANGUAGE IDC Training Centre."— Presentation transcript:

1 JOB CONTROL LANGUAGE IDC Training Centre

2 JCL CONCEPTS DURATION: 4 DAYS

3 Course Schedule DAY 1 DAY 2 DAY 3 DAY 4 Session 1 covers Basics of JCL
Session 2 covers JOB statement Session 3 covers EXEC statement DAY 2 Session 4 covers COND parameter of EXEC statement Session 5 covers DD statement DAY 3 Session 6 covers special DD names Session 7 covers Procedures and Symbolic parameters DAY 4 Session 8 covers various utilities Wrap up JCL V1.0

4 JCL BASICS SESSION 1

5 Batch versus Online Environment
In a batch environment Processing request submitted to the system is placed in a queue of requests submitted by users System processes requests and returns result Response time is long In an online environment Requests are processed immediately and response time is less JCL V1.0

6 Some Basic Terms JOB Is a unit of work to be processed
In Mainframe batch environment, it is one or more programs executing in sequence JCL Acronym for Job Control Language; Has its own syntax and rules of coding; hence is called a language Provides a mechanism, to communicate the requirements to execute a program, to the MVS operating system Is flexible with varieties of options for every requirement Programs coded in COBOL are executed in batch mode using JCL’s JCL V1.0

7 Working of JCL Every JCL coded has to be run; In Mainframe terminology, it is called submitting the JCL; henceforth known as submitting the JOB There is a subsystem in MVS called JES (short for Job Entry Subsystem) that manages JOBS submitted to the system by users JES Receives JOBS Schedules JOBS based on their priority Allocates resources to JOBS as they execute Processes output generated by JOBS JCL V1.0

8 Structure of JCL JCL consists of statements that provide specifications to execute a JOB A JOB consists of one or more steps and each step executes only one program JOB contains three basic JCL statements – JOB, EXEC and DD JOB Statement specifies details for executing the JOB as a whole EXEC Statement specifies details for executing a particular step within the JOB DD Statement specifies details for the data files required to execute a program in a step A JOB consists of all statements between a JOB statement and the next JOB statement or a null (‘//’) statement JCL V1.0

9 General Format of JCL Statement
JCL Statements are coded as 80 bytes records and are categorized into following fields: IDENTIFIER Field NAME Field OPERATION Field PARAMETER Field COMMENT Field JCL V1.0

10 JCL Field Definition Rules
IDENTIFIER field indicates a JCL statement and is coded in columns 1 to 2.; The field contains // or /* in columns 1 and 2. NAME field Specifies a name for the JCL statement Must start with an alphabet and between 1 to 8 alphanumeric characters Must begin in column 3 and can be continued till column 10 Must be followed by at least one blank space OPERATION field Specifies the type of JCL statement Coded immediately after the NAME field and specifies the type of JCL statement like EXEC, DD, PROC, PEND etc Must be preceded and succeeded by at least one blank space else will result in JCL error indicating unidentified operation field JCL V1.0

11 JCL Field Definition Rules
PARAMETER fields follow OPERATION field and separated by commas COMMENT field Follows parameter field and can contain any details Must be preceded by one blank Can be entered in all lines JCL V1.0

12 Parameter Fields Parameter fields are of two types – Positional and Keyword Parameters Positional Parameters Should be coded in a specific sequence Separated by commas Omitted parameters indicated by a comma to indicate the positional nature Keyword Parameters No specific sequence and can be coded in any order Format is parm=<value> Follow positional parameters Can be omitted altogether if required JCL V1.0

13 Comment Statement Identified as //* in columns 1 to 3
Enter comments in the remaining columns Can be placed anywhere after the JOB statement Used to document the details of the JCL In this visual, line 3 is a comment statement JCL V1.0

14 JOB STATEMENT SESSION 2

15 JOB Statement JOB statement identifies the JOB to the system
JOB Statement consists of JOBNAME JOB operator Positional Parameters Accounting Info Programmer NAME Keyword Parameters MSGCLASS CLASS MSGLEVEL NOTIFY REGION TIME PRTY COND RESTART TYPRUN JCL V1.0

16 JOB NAME Starts in column 3 following the identifier field
Should be between 1 to 8 characters First character should be Alphabetic and not a Number Should be followed by a space JCL V1.0

17 JOB Operator Preceded and succeeded by a blank space JCL V1.0

18 Positional Parameters
JOB statement consists of two positional parameters Job Accounting Information Programmer name JCL V1.0

19 Accounting Information
Identifies the Account number to the system to track the CPU time used by the JOB Has two positional sub parameters – Account number and Additional Accounting info Format is (<account-number>, <additional-accounting-info>) Is optional by contents, however, if omitted and the next parameter that is <programmer name> is coded, its absence is indicated by a comma to signify the positional nature of the parameter Format is installation dependent Within accounting info, If only <account-number> is specified, then parantheses can be omitted If only <additional-accounting-info> is specified, then the absence of <account-number> is specified by a comma to indicate the positional nature of the sub parameters JCL V1.0

20 Accounting Information - Examples
JCL V1.0

21 Accounting Information - Examples
JCL V1.0

22 Programmer Name Used for identifying name of the programmer and/or to provide any additional information about the JOB Coded immediately after the Accounting Information parameter Can be omitted. No need to code a comma if omitted Can be 1 to 20 characters long JCL V1.0

23 Programmer Name - Examples
JCL V1.0

24 Keyword Parameters Keyword parameters follow positional parameters and can be in any order Some of the keyword parameters used in the JOB statement are CLASS MSGCLASS MSGLEVEL PRTY NOTIFY COND REGION TIME TYPRUN RESTART JCL V1.0

25 CLASS Parameter Is an optional keyword parameter
Specifies the type of JOB submitted to the system Some JOBS are CPU intensive, while others are more Input-Output oriented; JOB characteristics like these are identified to the system by the CLASS parameter Format is CLASS=<class> where <class> is a character between A to Z or 0 to 9 Installations will have a default class assigned to the CLASS parameter Programmers to check with system administrator about list of classes defined in the system JCL V1.0

26 MSGCLASS Parameter Is an optional keyword parameter
Specifies the specific output device to which the messages are to be routed after completion of the JOB Format is MSGCLASS=<classname> where <classname> is a character between A to Z or 0 to 9 Assigns JOB log to a particular sysout CLASS Installations will have a default class assigned to the MSGCLASS parameter Programmers to check with system administrator about list of message classes defined in the system JCL V1.0

27 MSGLEVEL Parameter Is an optional Keyword parameter
Controls the level of listing of the JCL output of the JOB Formats available are MSGLEVEL=(<statements>, <messages>) MSGLEVEL=statements MSGLEVEL=(, <messages>) Permitted values for statements are 0 for listing only JOB statement 1 for listing all JCL statements including procedures 2 for listing only input statements Permitted values for messages are 0 for not listing any allocation messages 1 for listing all allocation messages Preferred option is MSGLEVEL=(1,1) JCL V1.0

28 MSGLEVEL(0,0) JESJCL: Shows only JOB statement details
JESYSMSG: Shows no allocation message details; Shows only Start and Stop times JCL V1.0

29 MSGLEVEL(0,1) JESJCL: Shows only JOB statement details
JESYSMSG: Shows all allocation messages JCL V1.0

30 MSGLEVEL(1,0) JESJCL: Shows all JCL statements
JESYSMSG: Shows no allocation message details; Shows only Start and Stop times JCL V1.0

31 MSGLEVEL(1,1) JESJCL: Shows all JCL statements
JESYSMSG: Shows all allocation message JCL V1.0

32 MSGLEVEL(2,0) JESJCL: Shows all JCL statements without substitutions
JESYSMSG: Shows no allocation message details; Shows only Start and Stop times JCL V1.0

33 MSGLEVEL(2,1) JESJCL: Shows all JCL statements without substitutions
JESYSMSG: Shows all allocation message JCL V1.0

34 PRTY Parameter PRTY Specifies priority for scheduling JOBS within a CLASS Permitted value ranges from 0 to 14 or 0 to 15 depending on JES2 or JES3 JCL V1.0

35 NOTIFY Parameter Specifies the user to whom JOB is to be submitted after completion Can specify the user ID or the parameter (&SYSUID) JCL V1.0

36 COND Parameter Specifies whether the JOB should continue or terminate depending on the outcome of any step in the JOB Before each step is executed, the system checks the COND parameter against the return code from completed JOB step If satisfied, the system terminates the JOB, else it executes the JOB Format is COND=((code, operator), (code, operator)…) JCL V1.0

37 Interpretation of Condition Codes
COND parameter check Return code from completed step Terminate JOB Execute JOB COND=(code,GT) RC < code RC > = code COND=(code,GE) RC <= code RC > code COND=(code,EQ) RC = code RC not = code COND=(code,LT) RC < = code COND=(code,LE) RC >= code COND=(code,NE) JCL V1.0

38 COND Parameter In this visual, condition code set at JOB level is COND=(4,LT) which interprets that if the Return Code from any step is greater than 4, bypass the remaining steps in the JOB Program RTCODE04 if executed returns a RC of 4 RTCODE08 if executed returns a RC of 8 RTCODE16 if executed returns a RC of 16 In the executed JOB STEP3 is bypassed as the Return Code from STEP2 is 8 which is greater than 4 JCL V1.0

39 COND Parameter Visual shows part of the JOBLOG of JOB executed with COND=(4,LT) JOBLOB shows the JOB terminated with STEP2 JCL V1.0

40 COND Parameter In the visual, condition code set at JOB level is COND=(8,GE) which interprets that if the RC from any step is less than or equal to 8, bypass the remaining steps in the JOB Program RTCODE16 in STEP1 if executed, returns a RC of 16 RTCODE00 in STEP2 if executed, returns a RC of 0 RTCODE04 if executed returns a RC of 4 Result is STEP3 is bypassed as the RC from STEP2 is 0 which is less than 8 JCL V1.0

41 COND Parameter Visual shows part of the JOBLOG of JOB executed with COND=(8,GE) JOBLOG shows the JOB terminated with STEP2 JCL V1.0

42 REGION Parameter Specifies the amount the workspace required by the operating system to execute the JOB Value specified will apply to each step Formats are: REGION=<value>K REGION=<value>M REGION parameter should only be in units of “K” or “M” indicating Kilobytes or Megabytes of workspace requested; Results in JCL error if unit is not specified If omitted, a default value is assigned by the system If REGION=0M is specified, the system takes the most optimum space JCL V1.0

43 TIME Parameter Specifies the maximum CPU execution time permitted for the JOB If actual CPU execution time exceeds value specified in the TIME parameter, JOB will fail with S322 abend Formats are TIME=(minutes, seconds) TIME=minutes TIME=(,seconds) TIME=1440 TIME=NOLIMIT Seconds can be in the range from 0 to fifty nine JCL V1.0

44 TYPRUN Parameter TYPRUN is used for special JOB processing Formats are
TYPRUN=HOLD TYPRUN=SCAN TYPRUN=HOLD causes the JOB to be held in the input queue till released by an operator TYPRUN=SCAN causes the JCL to be scanned for syntax errors and reports the errors. The JOB is not executed when this option is used JCL V1.0

45 RESTART Parameter Is an optional keyword parameter
Instructs the JOB to restart execution from a specific step, instead of from beginning of the JOB Formats are RESTART=<stepname> RESTART=<stepname.procstepname> JCL V1.0

46 EXEC STATEMENT SESSION 3

47 EXEC Statement EXEC statement identifies beginning of a STEP in a JOB
EXEC statement consists of An optional STEPNAME EXEC operation field Positional parameters PGM=<program-name> PROC=<proc-name> <proc-name> Some keyword parameters ACCT PARM REGION TIMER COND JCL V1.0

48 STEP NAME Specifies a name for the EXEC statement
Must start with an alphabet and between 1 to 8 alphanumeric characters Must begin in column 3 and be continued till column 10 Is optional; If defined must be unique within the JOB and the procedures that it invokes; It is a good practice to define one If it is required to refer the step in a later step in the JOB (like in a Condition code), then it is mandatory to name the referring step JCL V1.0

49 EXEC OPERATOR Preceded and succeeded by a blank space JCL V1.0

50 Positional Parameters
EXEC statement has two types of positional parameters which must precede any keyword parameters PGM=<program-name> PROC=<procname> <procname> JCL V1.0

51 PGM Parameter Identifies the name of the program to be executed in a step Format is PGM=<program-name>, where program-name is the load module name of the program to be executed program-name specified, should exist in either system libraries or in private libraries specified in STEPLIB or JOBLIB DDnames program-name must be a member of a partitioned data set and if it is not located, the JOB will abend with code S806, indicating, load module of the executing program not found JCL V1.0

52 Keyword Parameters Keyword parameters follow positional parameters and can be in any order Some of the keyword parameters used in the EXEC statement are ACCT PARM COND TIME REGION JCL V1.0

53 ACCT Parameter Code this parameter to specify the accounting information for the step Formats are: ACCT=(account-info, account-info) ACCT=account-info JCL V1.0

54 PARM Parameter Used to pass parameters to the program being executed
Format is PARM=<parm-value> where <parm-value> is a string of data of maximum 100 characters length If parm-value consists of special characters it must be enclosed within single quotes Data supplied through PARM parameter is passed to the Linkage Section of the COBOL program JCL V1.0

55 TIME Parameter Specifies maximum CPU execution time permitted for the step Formats are: TIME=(minutes, seconds) TIME=minutes TIME=(,seconds) TIME=1440 TIME=NOLIMIT If actual CPU execution time exceeds the value specified in the TIME parameter, executing step will fail with S322 abend JCL V1.0

56 REGION Parameter Specifies amount of storage space required to execute the step Formats are: REGION=<value>K REGION=<value>M <value> 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 JCL V1.0

57 EXEC STATEMENT SESSION 4

58 COND Parameter On completion of each step, a return-code is generated. This return-code can be checked and based on this a step can be bypassed or executed. This is done using the COND parameter Formats are: COND=(<return-code>, <condition operator>) COND=(<return-code>, <condition operator>, stepname) COND=(<return-code>, <condition operator>, stepname, EVEN) COND=(<return-code>, <condition operator>, stepname, ONLY) COND=EVEN COND=ONLY return-code is a number from 0 to 4095 Operator specifies the type of comparison to be made between the return-code and the return-code of a previous step Operator can be one of GT,LT,GE,LE,EQ,NE Stepname is the name of a prior step Multiple sets of conditions can be specified within parantheses. For bypassing, each set of conditions is OR’ed with the next set of conditions. Format is: COND=((<return-code>, operator, stepname), (<return-code>, operator, stepname)….) JCL V1.0

59 COND Parameter In the visual, examine the condition codes set in STEP2 and STEP3 The interpretation of the Condition codes set are In STEP2, if the RC from STEP1 is less than or equal to 8, STEP2 is executed In STEP3, if the RC from STEP2 is equal to 4, STEP3 is bypassed Program RTCODE00 in STEP1, if executed, returns a RC of 0 RTCODE04 in STEP2, if executed, returns a RC of 4 RTCODE08 in STEP3, if executed, returns a RC of 8 Result is,STEP3 is bypassed as the RC from STEP2 is 4 JCL V1.0

60 COND Parameter - Interpretation
COND parameter check Return code from referred step Terminate JOB Execute JOB COND=(code,GT,step) RC from step < code RC from step > = code COND=(code,GE,step) RC from step <= code RC from step > code COND=(code,EQ,step) RC from step = code RC from step not = code COND=(code,LT,step) RC from step < = code COND=(code,LE,step) RC from step >= code COND=(code,NE,step) JCL V1.0

61 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 JCL V1.0

62 DD STATEMENT SESSION 5

63 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 JCL V1.0

64 DDNAME Provides a link between the COBOL symbolic file name and the physical file name Specifies the physical file names of Input and Output files used by the COBOL programs along with their attributes In the visual, notice that the file defined as FILE1 gets mapped to the DDName FILE1 in the JCL; Same for file FILE2; This establishes connection between the logical file name in COBOL with the physical file name in JCL If the “ASSIGN TO” name in the COBOL program and the DDName in the JCL does not match then the JOB abends JCL V1.0

65 DDNAME Specifies a name for the DD statement
Must start with an alphabet and between 1 to 8 alphanumeric characters Must begin in column 3 and be continued till column 10 Is optional; If defined must be unique within the JOB and the procedures that it invokes; It is a good practice to define one JCL V1.0

66 Positional Parameters
Instream data (*) Indicates instream data follows this data End of data is indicated by /* or // Instream data cannot contain // in columns 1-2 DATA DATA is same as ‘*’ except that the instream data may contain // in column 1-2 Usually followed by a keyword parameter DLM=<XXX>, to indicate the new delimiter to be used for end of data JCL V1.0

67 Positional Parameters
DUMMY Positional Parameter Specifies that no files are to be allocated to the file being defined by the DDname Results in all input-output request to be ignored Useful for debugging in testing mode JCL V1.0

68 DSN - Keyword Parameter
Specifies the fully qualified physical name of the input or output file Format is DD DSN=<dataset-name> 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 JCL V1.0

69 DISP Keyword Parameter
Specifies the existing status (disposition) of the dataset and steps to be taken on successful/unsuccessful execution of the step Format is DISP=(<present-status>, <normal-end-status>, <abnormal-end-status>) present-status specifies current status, meaning whether the data set exists or is to be created and if it exists, the mode of access to it normal-end-status specifies how to handle the dataset upon successful completion of the JOB abnormal-end-status specifies how to handle the dataset upon abnormal termination of JOB Default values are DISP=(NEW,DELETE,DELETE) for new dataset and DISP=(OLD,KEEP,KEEP) for existing dataset JCL V1.0

70 DISP Keyword Parameter
DISP=(<present-status>, <normal-end-status>, <abnormal-end-status>) One or more sub parameters can be omitted but at least one should be coded Sub parameters are positional in nature If only <present-status> is coded, parantheses can be omitted If the <present-status> field is omitted and the <normal-end-status> and <abnormal-end-status> are coded, then parantheses are required and comma should be coded before the sub-parameters JCL V1.0

71 UNIT Keyword Parameter
Specifies information about the input or output devices used by the JOB Some formats are: UNIT=device-address UNIT=device-type UNIT=device-group-name JCL V1.0

72 SPACE Keyword Parameter
JCL V1.0

73 SPACE Keyword Parameter
Specifies Space required to allocate a new dataset on DASD Format is SPACE=(S1,(S2,S3,S4),S5,S6,S7) where S1 is mandatory and specifies one of following unit of allocation S2 is mandatory and specifies the primary quantity. S3 is optional and specifies the secondary quantity S4 is optional and specifies the directory blocks used for creating a partitioned dataset S5 is optional and is coded as RLSE S6 is optional and is coded as CONTIG S7 is optional and is coded as ROUND Examples: SPACE=(TRK,(10,2)) - Allocates 10 Tracks of primary space and 2 tracks of secondary space SPACE=(CYL,10,RLSE) - Allocates 10 Cylinders of primary space with no secondary space. Additional specifies that any unused space is to be released SPACE=(1000,(100,50),RLSE,ROUND) - Allocates 100 records of length 1000 bytes with secondary extents of 50 records. Additionally specifies to Release any unused space and to round off SPACE=(TRK,(10,5,5)) - Allocates 10 bytes of Primary space, 5 tracks of secondary space and space to hold 5 directory blocks SPACE=(5000,(10,2),,CONTIG) - Allocates 10 records of length 5000 bytes with 2 records of secondary space JCL V1.0

74 SPACE Keyword Parameter
SPACE=(S1,(S2,S3,S4),S5,S6,S7) <S1> sub parameter specifies unit of allocation. The units are: TRK – For allocating Space in units of tracks CYL – For allocating Space in units of cylinders <block-size> for allocating space in units of blocks; Exactly, how many bytes of data will be allocated depends on the value specified in the DCB=BLKSIZE sub parameter JCL V1.0

75 SPACE Keyword Parameter
SPACE=(S1,(S2,S3,S4),S5,S6,S7) <S2> sub parameter specifies primary quantity of space requested <S3> sub parameter Specifies secondary quantity of space which is allocated when primary quantity of space is insufficient Secondary space when allocated may not be contiguous with primary space If not specified or not available JOB will abend <S4> sub parameter Specifies the number of directory blocks for creating a Partitioned dataset JCL V1.0

76 SPACE Keyword Parameter
SPACE=(S1,(S2,S3,S4),S5,S6,S7) <S5> sub parameter – Specifies the option RLSE that indicates that any unused space allocated to a dataset be released once the dataset is closed. Takes time to release space <S6> sub-parameter Specifies a value CONTIG that indicates that only contiguous space should be allocated to the dataset Option applies only to primary space allocation Results in decreased dataset access time JOB abends if requested space is not contiguously available <S7> sub parameter Specifies a value ROUND JCL V1.0

77 DATA CONTROL BLOCK Parameter - DCB
Specifies the attributes of the dataset Sub parameters are: RECFM LRECL BLKSIZE DSORG JCL V1.0

78 DCB - Sub Parameters LRECL (Stands for Logical Record Length)
Format is LRECL=<record-length> Specifies record length in bytes for fixed and variable length records For variable record lengths, the LRECL should be 4 bytes more than the length of the largest record BLKSIZE Format is BLKSIZE=<block-size> 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 JCL V1.0

79 DCB – Sub Parameters RECFM – Specifies record format of dataset being created Format is RECFM=<record-format> where <record-format> can take one of the following values F Fixed FB - Fixed Blocked V Variable VB - Variable Blocked FBA - Fixed Block with carriage control as first character VBA - Variable Block with carriage control as first character U Undefined JCL V1.0

80 DCB – Sub Parameters DSORG specifies the way data set is organized
Format is DSORG=<dataset-organization> where <dataset-organization> can take one of following values: PS for Physical sequential PO for Partitioned organization JCL V1.0

81 Dataset Concatenation
Datasets can be concatenated and considered as one file by the system All datasets being concatenated must have the same record format All datasets being concatenated must exist on same type of device To concatenate datasets omit the DDname from all the DD statements except the first one In this visual FILE1 is a concatenated input dataset JCL V1.0

82 Special DD names SESSION 6

83 Special DD statements SYSIN JOBLIB STEPLIB JCLLIB SYSOUT SYSDUMP
SYSABEND JCL V1.0

84 SYSIN SYSIN is a special DDname used to pass in-stream data to the executing program In this visual, a data value of 1234 is passed to the program SAMPLE through SYSIN Beginning of the in-stream data is indicated by DD * End of the in-stream data is indicated by /* Data passed this way will be received in the COBOL program through the ACCEPT verb Receiving data item in the COBOL program must be of the same length as the length of data item passed. If less, then data is truncated JCL V1.0

85 JOBLIB If coded, specifies the library where the load module of the program to be executed will be searched first in any step Coded immediately after the JOB statement JCL V1.0

86 STEPLIB Specifies the library where the load module of the program to be executed will be searched Applies only to the step where it is specified JCL V1.0

87 SYSOUT Special DDname used for listing messages listed out of the DISPLAY verb used in COBOL program JCL V1.0

88 Dump related special DDnames
SYSDUMP Format is SYSDUMP DD …… Used to obtain a dump of the contents of various registers and variables in case of an abnormal end of program Dump is in hexadecimal format SYSABEND Format is SYSABEND DD …. Contains same details as SYSDUMP with more details SYSUDUMP SYSMDUMP JCL V1.0

89 Procedures and Symbolic Parameters
SESSION 7

90 Procedures Abbreviated as PROC
Consists of pre-tested JCL statements which is given a name Helps in minimizing duplication of code and hence errors Two types Instream Procedures Cataloged Procedures JCL V1.0

91 Instream Procedures Coded within the input stream of the JOB
Must be coded immediately after the JOB statement Can be invoked more than once within the JOB Starts with a PROC statement and ends with a PEND statement Formats for invoking the PROC are: EXEC <procname> EXEC PROC=<procname> <procname> must be 1 to 8 characters long JCL V1.0

92 Instream Procedure In this visual an in-stream PROC named SAMPLE is invoked. The PROC is defined before it is invoked Definition of PROC starts with the PROC statement and ends with the PEND statement JCL V1.0

93 Instream Procedure Visual shows the contents of the JESJCL of the JOB
The expansion of the PROC is identified by a leading ++ JCL V1.0

94 Cataloged Procedure Consists of a set of JCL statements that are grouped together, given a name and cataloged as a member of a Partitioned dataset Procedure name must be unique within the procedure library PEND statement is not required JCL V1.0

95 Cataloged Procedure Library to search the cataloged statements is specified through the JCLLIB operator One or more libraries can be specified in the JCLLIB In the visual, the procedure named SAMPLE is invoked. It exists as a member in the Partitioned dataset P390B97.PROCLIB that is specified in the JCLLIB JCL V1.0

96 Cataloged Procedure Visual shows the contents of a procedure, cataloged in a dataset Notice that the statement PEND is not coded JCL V1.0

97 Symbolic Parameters Allows same JCL procedure to be used with different parameters Very often used in situations where same JCL is used by different programmers with different parameters to access different datasets Consists of 1 to 8 characters. The first character must be & JCL V1.0

98 Symbolic Parameters Visual represents the passing of symbolic parameters to the PROC names SAMPLE The symbolic parameters passed are LOAD INPUT OUTPUT PRIMARY SECONDRY The parameters passed are resolved and mapped in the PROC JCL V1.0

99 Symbolic Parameters Visual represents the contents of the PROC
The symbolic parameters passed from the invoking JCL are mapped here The corresponding symbolic parameters in the PROC are prefixed by & Note the following parameters prefixed by & LOAD INPUT OUTPUT PRIMARY SECONDRY JCL V1.0

100 Symbolic Parameters This visual illustrates the concept of assigning default values to symbolic parameters Default values can be assigned to symbolic parameters in the PROC which can be overridden from the JCL. In this visual, note the default values assigned to the symbolic parameters EXSTSTAT RECLEN JCL V1.0

101 Symbolic Parameters In this visual, notice how the symbolic parameters are substituted JCL V1.0

102 Temporary Dataset Temporary datasets are prefixed with &&
In the visual, STEP1, creates a temporary dataset TEMP1 which is passed to the next step In STEP2, the same temporary dataset TEMP1 is accessed by specifying OLD,DELETE to indicate that it exists before this step and that it is to be deleted on successful completion of this step JCL V1.0

103 Backward Reference Used on the DD statement to copy information from previous DD statement To refer back to a DD statement in the same step, code *.ddname To referback to a DD statement in a previous step, code *.stepname.ddname Example: //STEP1 EXEC PGM=ABCD //DD1 DD DCB=RECFM=FB,… //DD2 DD DCB=*.DD1,… //STEP2 EXEC PGM=WXYZ //DD3 DD DCB=*.STEP1.DD1,… JCL V1.0

104 UTILITIES SESSION 8

105 SORT

106 SORT Arranges records in a file in ascending or descending sequence
Provides tailoring feature to select a subset of records from file for sorting Can reformat output file records after sorting Merges two or more file into a single file JCL V1.0

107 SORT JCL //JOB CARD………. <Specify JOB Card details here>
//STEPNAME EXEC PGM=SORT //STEPLIB DD <Specify library containing SORT program here> //SYSOUT DD <Specify the SORT Message dataset here for SORT utility to write messages as it executes> //SORTIN DD <Specify the SORT INPUT dataset here> //SORTWKnn DD <Specify the SORT temporary Work storage dataset here> //SORTOUT DD <Specify the SORT OUTPUT dataset here> //SYSIN DD <Specify SORT control statements here either as instream data or within a dataset to control the way sorting has to be done> JCL V1.0

108 SORT - SYSIN Parameters
Sort statements are coded through SYSIN which can be instream or cataloged Format is SORT FIELD=(<start-pos>,<length-in-bytes>,<field-format>,<sort-sequence>) <start-pos>, specifies starting position of field on which sorting is to be done <length-in-bytes>, specifies length of sort field in bytes <field-format>, specifies data format of the sort field. Field formats are CH for EBCDIC character sequence AC for ASCII character sequence BI for Binary sequence ZD for Zoned Decimal PD for Packed Decimal <sort-sequence> is either “A” or “D” indicating Ascending or Descending sequence JCL V1.0

109 SORT - SYSIN SYSIN as specified through a cataloged dataset JCL V1.0

110 SORT - SYSIN SYSIN as specified instream JCL V1.0

111 Consider a Book Store Record with following layout
SORT – An EXAMPLE Consider a Book Store Record with following layout Sl.NO FIELD START END DATA TYPE 1 BOOK TITLE 75 CHARACTER 2 AUTHOR’S LAST NAME 76 90 3 AUTHOR’S FIRST NAME 91 105 4 PUBLISHER 106 109 5 COURSE DEPARTMENT 110 114 6 COURSE NUMBER 115 119 7 COURSE NAME 120 144 8 INSTRUCTOR’S LAST NAME 145 159 9 INSTRUCTOR’S INITIAL 160 161 10 NUMBER IN STOCK 162 165 BINARY 11 NUMBER SOLD 166 169 12 PRICE 170 173 JCL V1.0

112 SORT - EXAMPLES A simple SORT
Consider sorting the Book store record by Course Department in Ascending order Syntax would be: SORT FIELDS=(110,5,CH,A) SORT on multiple fields Consider sorting the Book store by Course Department, Course number and Book title in ascending order Syntax would be: SORT FIELDS=(110,5,CH,A,115,5,CH,A,1,75,CH,A) In above example, the first two fields being contiguous can be coded as SORT FIELDS=(110,10,CH,A,1,75,CH,A) In the above example, since all fields are of same type, it can be coded as SORT FIELDS=(110,10,A,1,75,A),FORMAT=CH JCL V1.0

113 TAILORING - Input File Specified using INCLUDE or OMIT control statements INCLUDE and OMIT cannot be used together Inclusion and omission done by comparing a record field with With another field OR With a constant Two or more conditions combined by logical ‘AND’ and ‘OR’ JCL V1.0

114 File Tailoring Rules Leave at least one blank space and write INCLUDE
Leave at least blank space and write COND= Write the following parameters Offset, length and format of field to be compared Comparison operator Location, length and data format of the field compared against a constant JCL V1.0

115 File Tailoring Operators
EQ for Equal To NE for Not Equal To GT for Greater Than GE for Greater Than or Equal To LT for Less Than LE for Less Than Or Equal To JCL V1.0

116 TAILORING - Examples Consider listing Books in Ascending order of Book title for which number sold exceeds 250 Syntax would be INCLUDE COND=(166,4,BI,GT,250) SORT FIELDS=(1,75,CH,A) Consider listing Books in Descending order of PRICE for which NUMBER SOLD exceeds 125 and LAST NAME of the author is ABCDEF Syntax would be: OMIT COND=(166,4,BI,LE125,OR,76,15,CH,NE,C’ABCDEF’) SORT FIELDS=(170,4,BI,D) JCL V1.0

117 FILE REFORMATTING Fields can be deleted
Order of the fields can be rearranged Zeroes or blanks can be inserted before, between or after fields Reformatting is done using INREC or OUTREC statements Reformatting can change record length. If so specify, new record length in SORTOUT DD statement JCL V1.0

118 REFORMATTING USING OUTREC
Leave at least one blank and code OUREC Leave at least one blank and code FIELDS= Input location and length of fields to appear in desired order Data format is not specified JCL V1.0

119 OUTREC - EXAMPLES //SORTOUT DD DSN=BOOK.OUTPUT,
Consider organizing the book store to list Book Title and Number in Stock in Ascending order of Book title SYNTAX //SORTOUT DD DSN=BOOK.OUTPUT, // DISP=(NEW,CATLG,DELETE), // UNIT=DISK,VOL=SER=TRG001, // DCB=(RECFM=FB,LRECL=79,BLKSIZE=790), // SPACE=(TRK,5,2),RLSE) //SYSIN DD * SORT FIELDS =(1,75,CH,A) OUTREC FIELDS=(1,75,162,4) /* JCL V1.0

120 OUTREC - EXAMPLES Consider adding a 4 byte binary field between Book Title and Number in Stock and fill it with ZEROES Syntax would be : OUTREC FIELDS=(1,75,4Z,162,4) Consider prefixing a 20 character BLANK field to the output record Syntax would be : OUTREC FIELDS=(20X,1,75,4Z,162,4) JCL V1.0

121 REFORMATTING USING INREC
Allows records to be reformatted before processing If reformatting using INREC changes the location of the key fields, specify the location of the SORT field Consider that only Book Title and Number Sold are to appear in Descending order of Number Sold Syntax would be //SYSIN DD * INREC FIELDS=(1,75,166,4) SORT FIELDS=(76,4,BI,D) /* JCL V1.0

122 FILE MERGING Files to be merged should be sorted on the same set of keys on which they are merged Do not use SORTWKnn DD statements Specify SORTINnn DD for each input file In control statements MERGE replaces SORT JCL V1.0

123 FILE MERGING - EXAMPLE Consider merging three files that are sorted in Ascending sequence of Course Department and Course Number and Descending order of NUMER IN STOCK SYNTAX: //SORTIN01 DD DSN=….. <Specify File1 to be merged> //SORTIN02 DD DSN=….. <Specify File2 to be merged> //SORTIN03 DD DSN=….. <Specify File3 to be merged> //SORTOUT DD DSN=….. <Specify merged file name> //SYSIN DD * MERGE FIELDS=(110,10,CH,A,162,4,BI,D) /* JCL V1.0

124 IEBCOPY

125 IEBCOPY Purposes Copy a partitioned dataset to a sequential dataset
Merge datasets Copy and re-block load modules Select members from dataset to be copied, unloaded or loaded Replace selected members Exclude members from dataset to be copied, loaded or unloaded Create a backup of a partitioned dataset Copy one or more datasets per copy operation JCL V1.0

126 IEBCOPY JCL //JOB CARD…. //STEP01 EXEC PGM=IEBCOPY
//SYSPRINT DD Specify a sequential data set for messages //SYSUT1 DD Specify an INPUT partitioned dataset //SYSUT2 DD Specify an OUTPUT partitioned dataset //SYSUT3 DD Specify a spill work dataset //SYSUT4 DD Specify a spill work dataset //SYSIN DD Specify the control dataset JCL V1.0

127 IEBGENER

128 IEBGENER Create a backup of a sequential dataset or a member of a partitioned dataset Produce a partitioned dataset or a member of it from a sequential dataset Expand an existing Partitioned dataset by creating members and merging them into existing datasets Produce an edited dataset Re-block or change the logical record length of a dataset JCL V1.0

129 IEBGENER JCL //JOB Card….. //STEP EXEC PGM=IEBGENER
//SYSPRINT DD <Specify dataset for messages> //SYSUT1 DD <Specify input dataset> //SYSUT2 DD <Specify output dataset> //SYSIN DD <Specify control dataset> JCL V1.0

130 IEFBR14

131 IEFBR14 Dummy utility and does nothing
By specifying a suitable DISP parameter a dataset can be allocated or deleted using this utility For allocation, specify as //STEP EXEC PGM=IEFBR14 //FILE1 DD DSN=<dataset-name> DISP=(NEW,CATLG,DELETE), DCB=(…) For deletion, specify as //FILE1 DD DSN=<dataset-name>,DISP=(MOD,DELETE), // SPACE=(TRK,(1,1),RLSE) JCL V1.0

132 Generation Data Group

133 GDG Group of datasets related to each other chronologically and functionally GDG’s have to be created before creating datasets that are to be included in them Following to be specified to create a GDG Name of GDG Number of generations to be retained When a GDG is created initially it will not have any datasets within it Each dataset added to a GDG must be of the same type JCL V1.0

134 GDG In the visual, in STEP 1, GDG base is created
In STEP2, a version of the GDG is created using a model dataset JCL V1.0


Download ppt "JOB CONTROL LANGUAGE IDC Training Centre."

Similar presentations


Ads by Google