top of page

forestlimittvグループ

Public·252 members
Caleb Richardson
Caleb Richardson

The MVS JCL Primer: The Best Book for COBOL Programmers in IBM's MVS Mainframe Operating Environment



Introduction




If you are a COBOL programmer in IBM's MVS mainframe operating environment, you may have encountered JCL, or Job Control Language. JCL is a scripting language that controls the execution of programs and the allocation of resources on the mainframe. JCL can be challenging to learn, but it is essential for managing complex and large-scale applications. In this article, we will introduce you to JCL and its basic concepts, and then we will review one of the best books on this topic: The MVS JCL Primer by Saba Zamir and Chander Ranade. This book is a comprehensive and accessible guide that teaches novices and experienced users alike how to write effective and error-free JCL code. We will also provide some key examples and concepts from the book that will help you understand and master JCL. What is JCL?




Why is JCL important?




JCL stands for Job Control Language, which is a scripting language that controls the execution of programs and the allocation of resources on IBM mainframes. A mainframe is a large and powerful computer system that can handle thousands of users and applications simultaneously. Mainframes are used for critical and high-volume tasks such as banking, insurance, airline reservations, and government operations. JCL is important because it allows you to specify what programs you want to run, what data sets you want to use or create, what devices you want to use for input or output, what parameters you want to pass to the programs, and what actions you want to take in case of errors or abnormal situations. JCL also allows you to control the priority, scheduling, and accounting of your jobs. How to write JCL statements?




JCL consists of statements that follow a specific syntax and structure. A statement is a line of code that starts with a slash (/) or a double slash (//) and ends with a comma (,) or a blank. A statement can have one or more parameters that are separated by spaces or commas. A parameter can have one or more subparameters that are enclosed in parentheses. There are three types of JCL statements: - Job statement: This is the first statement in a JCL stream, which identifies the job name, owner, class, priority, accounting information, and other global attributes. - Exec statement: This statement specifies the name of the program or procedure that you want to execute, along with any arguments or options. - DD statement: This statement defines the data sets that are used or created by the program or procedure, along with their attributes such as name, type, size, location, disposition, etc. A JCL stream can have one or more job steps, which are groups of statements that perform a specific task. A job step can have one exec statement and zero or more DD statements. A job step can also have comments that start with //* and end with a blank. Here is an example of a simple JCL stream that has one job step: ```jcl //MYJOB JOB (123),'SABA',CLASS=A,MSGCLASS=X,NOTIFY=&SYSUID //STEP1 EXEC PGM=HELLO //SYSPRINT DD SYSOUT=* //SYSIN DD * HELLO WORLD /* ``` This JCL stream does the following: - It defines a job named MYJOB with accounting number 123, owner name SABA, class A, message class X, and notification option. - It executes a program named HELLO that prints a message to the standard output. - It defines two data sets: SYSPRINT, which is the output data set that receives the message from the program, and SYSIN, which is the input data set that contains the message to be printed. Both data sets are allocated dynamically and deleted after the job is completed. What is the MVS JCL Primer?




Who are the authors?




The MVS JCL Primer is a book written by Saba Zamir and Chander Ranade, who are both experienced software engineers and educators. Saba Zamir is working as a software engineer at Moody's Investor Services, New York. Chander Ranade is a senior consultant at IBM Global Services, New York. They have both taught JCL and other mainframe topics at various institutions and organizations. What are the main features of the book?




The MVS JCL Primer is a comprehensive and accessible guide that teaches novices and experienced users alike how to write effective and error-free JCL code. The book has the following features: - It covers all the essential topics of JCL, such as syntax, structure, statements, parameters, data sets, utilities, VSAM, TSO/ISPF, etc. - It provides hundreds of examples of JCL segments followed by easy to understand explanations and tips. - It includes three complete chapters on JCL utilities, such as IEBGENER, IEBCOPY, IDCAMS, etc., that show how to perform common tasks such as copying, sorting, merging, deleting, renaming, etc. - It also includes four chapters on VSAM basics, such as what is VSAM, how to define VSAM files, how to access VSAM files, etc. - It has a separate chapter on TSO/ISPF (Time Sharing Option/Interactive System Productivity Facility), which is a user interface that allows you to create, edit, submit, and manage JCL and other mainframe files. - It explains the relationship of JCL with corresponding COBOL programs and shows how to pass parameters and data between them. - It also provides a wealth of review questions and answers at the end of each chapter to test your knowledge and understanding. How to use the book?




The book is designed to be used as a self-study guide or as a reference manual. You can read it from cover to cover or jump to any topic that interests you. You can also use it as a supplement to your mainframe courses or training programs. The book assumes that you have some basic knowledge of COBOL and mainframe concepts. However, it does not require any prior experience with JCL or other mainframe languages. The book is organized into 16 chapters that cover the following topics: - Chapter 1: Introduction to JCL - Chapter 2: Job Statement - Chapter 3: Exec Statement - Chapter 4: DD Statement - Chapter 5: Data Sets - Chapter 6: Procedures - Chapter 7: Symbolic Parameters - Chapter 8: Conditional Processing - Chapter 9: JCL Utilities - Part I - Chapter 10: JCL Utilities - Part II - Chapter 11: JCL Utilities - Part III - Chapter 12: VSAM Basics - Part I - Chapter 13: VSAM Basics - Part II - Chapter 14: VSAM Basics - Part III - Chapter 15: VSAM Basics - Part IV - Chapter 16: TSO/ISPF What are some key concepts and examples from the book?




JCL syntax and structure




Job statement




The job statement is the first statement in a JCL stream that identifies the job name, owner, class, priority, accounting information, and other global attributes. The syntax of the job statement is as follows: ```jcl //jobname JOB (accounting-info), 'owner-name', keyword1=value1, keyword2=value2,... ``` The jobname can be any alphanumeric name up to eight characters long. The accounting-info is optional and can be any alphanumeric string up to eight characters long. The owner-name is optional and can be any alphanumeric string up to 20 characters long. The keywords are optional and can be any of the following: Keyword Description Example ------- ----------- ------- MSGCLASS Specifies the output destination of the job messages MSGCLASS=X NOTIFY Specifies the user ID to be notified when the job is completed NOTIFY=&SYSUID PRTY Specifies the execution priority of the job PRTY=10 REGION Specifies the amount of virtual storage required for the job REGION=4096K TIME Specifies the maximum CPU time allowed for the job TIME=1440 Here is an example of a job statement: ```jcl //MYJOB JOB (123),'SABA',CLASS=A,MSGCLASS=X,NOTIFY=&SYSUID ``` This statement defines a job named MYJOB with accounting number 123, owner name SABA, class A, message class X, and notification option. Exec statement




The exec statement specifies the name of the program or procedure that you want to execute, along with any arguments or options. The syntax of the exec statement is as follows: ```jcl //stepname EXEC PGM=program-name, keyword1=value1, keyword2=value2,... ``` or ```jcl //stepname EXEC PROC=procedure-name, keyword1=value1, keyword2=value2,... ``` The stepname can be any alphanumeric name up to eight characters long. The program-name or procedure-name can be any alphanumeric name up to eight characters long. The keywords are optional and can be any of the following: Keyword Description Example ------- ----------- ------- COND Specifies the condition code for skipping or executing the step COND=(4,LT) PARM Specifies the parameters to be passed to the program or procedure PARM='ABC' TIME Specifies the maximum CPU time allowed for the step TIME=60 Here is an example of an exec statement: ```jcl //STEP1 EXEC PGM=HELLO,PARM='WORLD' ``` DD statement




The DD statement defines the data sets that are used or created by the program or procedure, along with their attributes such as name, type, size, location, disposition, etc. The syntax of the DD statement is as follows: ```jcl //ddname DD keyword1=value1, keyword2=value2,... ``` The ddname can be any alphanumeric name up to eight characters long. The keywords are optional and can be any of the following: Keyword Description Example ------- ----------- ------- DSN Specifies the name of the data set DSN=MYFILE DISP Specifies the disposition of the data set (status, normal termination, abnormal termination) DISP=(NEW,CATLG,DELETE) DCB Specifies the data control block attributes of the data set (record format, record length, block size, etc.) DCB=(RECFM=FB,LRECL=80,BLKSIZE=800) SPACE Specifies the space allocation for the data set (primary and secondary extents, number of tracks or cylinders, etc.) SPACE=(TRK,(10,5),RLSE) SYSOUT Specifies that the data set is a system output data set and assigns a destination class to it SYSOUT=A Here is an example of a DD statement: ```jcl //SYSPRINT DD SYSOUT=* ``` This statement defines a system output data set named SYSPRINT and allocates it dynamically to the default output device. JCL utilities




IEBGENER




IEBGENER is a JCL utility that copies one sequential data set to another. It can also perform some basic editing functions such as inserting or deleting records, changing record formats, etc. The syntax of IEBGENER is as follows: ```jcl //stepname EXEC PGM=IEBGENER //SYSUT1 DD DSN=input-data-set-name,... //SYSUT2 DD DSN=output-data-set-name,... //SYSPRINT DD SYSOUT=* //SYSIN DD * control-statements /* ``` The stepname can be any alphanumeric name up to eight characters long. The input-data-set-name and output-data-set-name can be any valid data set names. The control-statements are optional and can be any of the following: Control statement Description Example ----------------- ----------- ------- GENERATE MAXFLDS=n Specifies the maximum number of fields to be copied from each input record GENERATE MAXFLDS=5 RECORD FIELD=(length,start),... Specifies the length and start position of each field to be copied from each input record RECORD FIELD=(10,1),(5,11),(15,16) INCLUDE COND=(field1,relop,value),... Specifies the condition for selecting input records to be copied INCLUDE COND=(1,EQ,C'ABC') OMIT COND=(field1,relop,value),... Specifies the condition for rejecting input records to be copied OMIT COND=(5,EQ,ZERO) Here is an example of IEBGENER that copies only the first 10 characters of each record from an input data set to an output data set: ```jcl //STEP1 EXEC PGM=IEBGENER //SYSUT1 DD DSN=MYFILE.IN,... //SYSUT2 DD DSN=MYFILE.OUT,... //SYSPRINT DD SYSOUT=* //SYSIN DD * GENERATE MAXFLDS=1 RECORD FIELD=(10,1) /* IEBCOPY




IEBCOPY is a JCL utility that copies one or more members of a partitioned data set (PDS) to another PDS. It can also perform some other functions such as compressing, merging, renaming, deleting, etc. The syntax of IEBCOPY is as follows: ```jcl //stepname EXEC PGM=IEBCOPY //SYSUT1 DD DSN=input-PDS-name,... //SYSUT2 DD DSN=output-PDS-name,... //SYSPRINT DD SYSOUT=* //SYSIN DD * control-statements /* ``` The stepname can be any alphanumeric name up to eight characters long. The input-PDS-name and output-PDS-name can be any valid PDS names. The control-statements are optional and can be any of the following: Control statement Description Example ----------------- ----------- ------- COPY OUTDD=ddname,... Specifies the output data set name and other options for copying COPY OUTDD=SYSUT2 SELECT MEMBER=(member1,...),... Specifies the members to be copied from the input data set SELECT MEMBER=(ABC,DEF) RENAME MEMBER=(oldname,newname),... Specifies the members to be renamed in the output data set RENAME MEMBER=(ABC,XYZ) DELETE MEMBER=(member1,...),... Specifies the members to be deleted from the output data set DELETE MEMBER=(DEF,GHI) Here is an example of IEBCOPY that copies two members (ABC and DEF) from an input PDS to an output PDS and renames one member (ABC to XYZ): ```jcl //STEP1 EXEC PGM=IEBCOPY //SYSUT1 DD DSN=MYLIB.IN,... //SYSUT2 DD DSN=MYLIB.OUT,... //SYSPRINT DD SYSOUT=* //SYSIN DD * COPY OUTDD=SYSUT2 SELECT MEMBER=(ABC,DEF) RENAME MEMBER=(ABC,XYZ) /* ``` IDCAMS




IDCAMS is a JCL utility that performs various functions on VSAM and non-VSAM data sets. It can create, delete, alter, print, list, copy, rename, etc. The syntax of IDCAMS is as follows: ```jcl //stepname EXEC PGM=IDCAMS //SYSPRINT DD SYSOUT=* //SYSIN DD * command-statements /* ``` The stepname can be any alphanumeric name up to eight characters long. The command-statements are optional and can be any of the following: Command statement Description Example ----------------- ----------- ------- DEFINE CLUSTER(...) Defines a VSAM cluster (a group of data sets that store related data) DEFINE CLUSTER(NAME(MYFILE)...) DELETE data-set-name,... Deletes one or more data sets DELETE MYFILE PURGE ALTER data-set-name,... Alters the attributes of one or more data sets ALTER MYFILE VOLUMES(NEWVOL) PRINT INFILE(data-set-name) ... Prints the contents of a data set PRINT INFILE(MYFILE) COUNT(10) LISTCAT ENTRIES(data-set-name) ... Lists the catalog entries of a data set LISTCAT ENTRIES(MYFILE) ALL REPRO INFILE(data-set-name) OUTFILE(data-set-name) ... Copies the contents of one data set to another data set REPRO INFILE(MYFILE.IN) OUTFILE(MYFILE.OUT) Here is an example of IDCAMS that defines a VSAM cluster named MYFILE with two components: a key-sequenced data set (KSDS) named MYFILE.DATA and an index data set named MYFILE.INDEX: ```jcl //STEP1 EXEC PGM=IDCAMS //SYSPRINT DD SYSOUT=* //SYSIN DD * DEFINE CLUSTER(NAME(MYFILE) - INDEXED - KEYS(10 0) - RECORDSIZE(80 80) - VOLUMES(VOL001) - ) - DATA(NAME(MYFILE.DATA)) - INDEX(NAME(MYFILE.INDEX)) /* VSAM basics




What is VSAM?




VSAM stands for Virtual Storage Access Method, which is a method of accessing and managing data sets on IBM mainframes. VSAM data sets are organized into clusters, which are groups of related data sets that store data in a logical and efficient way. VSAM clusters can have one or more of the following types of data sets: - Key-sequenced data set (KSDS): This is a data set that stores records in ascending order by a key field. Each record has a unique key that identifies it. A KSDS also has an index that allows fast and direct access to any record by its key value. - Entry-sequenced data set (ESDS): This is a data set that stores records in the order they are added. Each record has a relative byte address (RBA) that identifies its position in the data set. An ESDS does not have an index, so access to records is sequential or by RBA. - Relative record data set (RRDS): This is a data set that stores records in fixed-length slots. Each record has a relative record number (RRN) that identifies its slot number in the data set. An RRDS also has an index that allows direct access to any record by its RRN. How to define VSAM files?




To define VSAM files, you need to use the IDCAMS utility with the DEFINE CLUSTER command. The DEFINE CLUSTER command allows you to specify the name, type, attributes, and components of the VSAM cluster. The syntax of the DEFINE CLUSTER command is as follows: ```jcl DEFINE CLUSTER(NAME(cluster-name) - cluster-options - ) - component-options ``` The cluster-name can be any valid data set name up to 44 characters long. The cluster-options are optional and can be any of the following: Cluster option Description Example -------------- ----------- ------- INDEXED Specifies that the cluster is a KSDS INDEXED NONINDEXED Specifies that the cluster is an ESDS NONINDEXED NUMBERED Specifies that the cluster is an RRDS NUMBERED KEYS(key-length key-offset) Specifies the length and offset of the key field for a KSDS KEYS(10 0) RECORDSIZE(minimum maximum) Specifies the minimum and maximum record length for the cluster RECORDSIZE(80 80) VOLUMES(volume-name,...) Specifies the volume names where the cluster will be allocated VOLUMES(VOL001 VOL002) The component-options are optional and can be any of the following: Component option Description Example ---------------- ----------- ------- DATA(NAME(data-set-name) - data-options - ) Specifies the name and options for the data component of the cluster DATA(NAME(MYFILE.DATA)) INDEX(NAME(data-set-name) - index-options - ) Specifies the name and options for the index component of the cluster (only for KSDS and RRDS) INDEX(NAME(MYFILE.INDEX)) The data-options and index-options are optional and can be any of the following: Data option / Index option Description Example -------------------------- ----------- ------- SPACE(space-parameters) Specifies the space allocation for the data or index component SPACE(TRK,(10,5),RLSE) CISZ(size) Specifies the control interval size for the data or index component (a control interval is a unit of physical storage that contains one or more records) CISZ(4096) FREESPACE(CI-percent CA-percent) Specifies the percentage of free space to be left in each control interval and control area (a control area is a group of control intervals) for future insertions or updates (only for KSDS) FREESPACE(10 20) Here is an example of defining a VSAM KSDS cluster named MYFILE with two components: a data component named MYFILE.DATA and an index component named MYFILE.INDEX: ```jcl DEFINE CLUSTER(NAME(MYFILE) - INDEXED - KEYS(10 0) - RECORDSIZE(80 80) - VOLUMES(VOL001 VOL002) - ) - DATA(NAME(MYFILE.DATA) - SPACE(TRK,(10,5),RLSE) - CISZ(4096) - FREESPACE(10 20) - ) - INDEX(NAME(MYFILE.INDEX) - SPACE(TRK,(5,2),RLSE) - CISZ(1024) - ) How to access VSAM files?




To access VSAM files, you need to use the DD statement with the DSN parameter to specify the name of the VSAM cluster. You can also use other parameters such as DISP, DCB, AMP, etc. to specify the disposition, attributes, and access method options for the VSAM file. The syntax of the DD statement for VSAM files is as follows: ```jcl //ddname DD DSN=cluster-name,... ``` The ddname can be any alphanumeric name up to eight characters long. The cluster-name can be any valid VSAM cluster name up to 44 characters long. The other parameters are optional and can be any of the following: Parameter Description Example --------- ----------- ------- DISP Specifies the disposition of the VSAM file (status, normal termination, abnormal termination) DISP=(OLD,KEEP,KEEP) DCB Specifies the data control block attributes of the VSAM file (record format, record length, block size, etc.) DCB=(RECFM=FB,LRECL=80,BLKSIZE=800) AMP Specifies the access method parameters for the VSAM file (control inte


About

グループへようこそ!他のメンバーと交流したり、最新情報を入手したり、動画をシェアすることができます。

Members

bottom of page