|
The American Programmer | |
| Home | Programming | Books for Computer Professionals | Privacy | Terms |
| Home > Programming > Just Enough > Just Enough JCL |
| Home > Programming > Manuals > JCL Manuals > Just Enough JCL |
Just Enough JCL Tutorial
to be dangerous
The purpose of this booklet is to get you started with JCL when there is no other way - you don’t have time to go to a class, don’t want to buy a complete book on it and try to find the things you need to know.
---------------------------------------------- Table of Contents ----------------------------------------------
JCL Example
Sample JCL DD Statements
Just Examples
JCL Example
This is an example of a JCL job.
The small numbers are notes that will be explained later.
This set of JCL will execute the program SAMPLE1, which is shown below.
The JCL tells the system what files are to be used by the program.
The system will verify that the files are available before allowing the program to run.
There are three major parts to this set of JCL.
JOB information, the first two lines
program execution information, line 4
information about the data files, line 5 to the end.
In all the examples, TSOUSR1 is an imaginary TSO user id, a logon id, an account.
Replace it with your own user id.
Anything shown in bold print is required by JCL syntax: it’s a keyword.
Anything in regular print is a user-chosen name: you could have chosen a different name.
2 3 4 5
1
1//TSOUSR1A JOB (12345),’JOE DOKES’,6 7 8
2 // MSGCLASS=X,CLASS=A,NOTIFY=TSOUSR1
9
3 //* SAMPLE JOB
10 11 12
4 //STEP1 EXEC PGM=SAMPLE1
13 14
5 //STEPLIB DD DSN=TSOUSR1.LOAD,DISP=SHR
15 16 17
6 //INFILE DD DSN=TSOUSR1.DATA(MEMBER),DISP=SHR
18 19
7 //OUTFILE DD SYSOUT=*
20
8 //SYSOUT DD SYSOUT=*
1 The two slashes indicate that a line is JCL
they are found in columns 1 and 2
2 A typical job used for testing programs is named after the
user id of the person who is submitting it.
A letter or number is added to the end of the user id.
3 The word JOB in this position indicates that this line is the
JOB statement which defines the job being submitted.
4 You put accounting information in this position,
in the parentheses. This is different for every company.
5 You put your name inside the apostrophes.
This appears on the job print and identifies who submitted it.
6 Message class specifies a print class for the job.
A print class refers to a specific printer, a type of printer,
or a printer in a specific location.
Find out what you are supposed to use here
and substitute it for m.
7 Class tells the system how important your job is.
Find out the proper testing job class to use here,
and substitute it for c.
8 Notify asks the system to send a message to the
TSO user id specified when the job ends,
telling if the job ended with no apparent problems,
or had serious problems.
9 This whole line is a comment. It does nothing.
The sign of a comment is //* in columns 1 - 3.
10 This line tells the system to execute the program named SAMPLE1.
STEP1 is a descriptive name that you choose.
The system uses it in messages about your job;
you use it when creating overrides for procedure JCL. (not covered here)
11 EXEC PGM= says that this is a program that the system is to execute.
12 This is the name of the program.
13 STEPLIB tells the system that the executable program is found on this
library. Find out if your company requires this.
14 DSN says that this is the name of the dataset. Dataset
is IBM’s term for a file, or for a library (a file containing
smaller files known as members)
15 INFILE is the name used in the program to refer to the file.
(see note 3 in the program)
Its only purpose is to enable the system to find the
correct JCL statement which further describes the file.
16 This DSN (Data Set Name) refers to a member in a library.
The name in parentheses is the member name you wish to use in the library specified
17 DISP=SHR means that the dataset specified already exists,
and that the system is to go search for it, and that you don’t mind if
other jobs are using it at the same time as you.
18 OUTFILE is the name used in the program to refer to the file.
19 SYSOUT here means system output, a generic term which really
means printer class. See the note about the JOB MSGCLASS.
20 SYSOUT here refers to the file that is automatically
created by the COBOL compiler when you use the COBOL
verb DISPLAY. See note 8 in the program.
This is the COBOL program that might be used with the above JCL.The small numbers are notes that will be explained later.
This is not a book on COBOL. For better explanations of COBOL see the
book on COBOL.
IDENTIFICATION DIVISION.
PROGRAM-ID. 'SAMPLE1'
1ENVIRONMENT DIVISION.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
2
SELECT IN-FILE ASSIGN INFILE.
34
SELECT OUT-FILE ASSIGN OUTFILE.
5DATA DIVISION.
FILE SECTION.
FD IN-FILE
6RECORD CONTAINS 80 CHARACTERS
RECORDING MODE F.
01 IN-FILE-RECORD PIC X(80).
FD OUT-FILE
7RECORD CONTAINS 96 CHARACTERS
RECORDING MODE F.
01 OUT-FILE-RECORD PIC X(96).
WORKING-STORAGE SECTION.
77 EOF-FLAG PIC X(3) VALUE SPACE.
PROCEDURE DIVISION.
DISPLAY 'I AM THE SAMPLE1 PROGRAM STARTING'
8OPEN INPUT IN-FILE
9OPEN OUTPUT OUT-FILE
10READ IN-FILE
AT END
DISPLAY 'EMPTY FILE'
MOVE 'EOF' TO EOF-FLAG
END-READ
MOVE IN-FILE-RECORD TO OUT-FILE-RECORD
WRITE OUT-FILE-RECORD
MOVE 'HELLO THERE' TO OUT-FILE-RECORD
WRITE OUT-FILE-RECORD
CLOSE IN-FILE OUT-FILE
DISPLAY 'I AM THE SAMPLE1 PROGRAM ENDING'
GOBACK.
1 This is the program name. With many compile procedures this name
is the name that is used in the JCL
2 The name IN-FILE is a user-chosen name for one of the files
used by this program. This name is used everywhere else in
the program to talk about the file.
3 The name INFILE is the JCL name for the file, officially called
the DDNAME. It is found only once in the program. Its only purpose
is to link the program’s file definition to the JCL’s file definition
known as the DD statement.
The system will use information from both the program and the JCL
to fully define the file. Information found in the program
will override information found in the JCL.
By default, this says that the file is not a VSAM file,
but that it is an ordinary sequential file or a member of a PDS/Library.
4 OUT-FILE. See IN-FILE.
5 OUTFILE. See INFILE.
6 This is the FD or file description for IN-FILE. It contains the following
information
Record length obtained from the pictures on the record
Record format whether the file
is F - Fixed format, all records are the same length
or V - Variable format, records may be of different lengths.
It does not say anything about blocking.
The system handles blocking.
7 OUT-FILE. See IN-FILE.
8 The COBOL DISPLAY verb creates a file with a JCL DDNAME of SYSOUT.
There is no need to further define this file in the program.
9 Opening IN-FILE for INPUT, reading, means that the file must be present.
The JCL DD statement for INFILE must reference a file that exists.
10 Opening OUT-FILE for OUTPUT, writing, means that the file is not
normally present, that the JCL DD statement for OUTFILE
will specify a file that is to be created.
If the JCL DD specifies a file that exists, it will be clobbered.
Sample JCL DD Statements
You’ll find here examples of JCL DD statements covering most of the possibilities. Any statement not shown is rare indeed. Use the statements for existing data with files which are opened for INPUT in the program. Use the statements for creating data with files that are opened for OUTPUT. Your company’s requirements may be different from the generic statements shown.
I will show you those that are practical. I’ve eliminated the ones that are unrealistic.
This is one possible hierarchical breakdown of the different types of files.
Disk
permanent, catalogued
sequential (generic) non generation dataset
generation dataset
a PDS member: acts like sequential
VSAM
temporary
sequential (generic)
Tape
permanent, catalogued
sequential (generic) non generation dataset
generation dataset
Some definitions.
Permanent Not deleted until you request it, or for generation datasets, when a dataset
exceeds the limit and is deleted by the system.
Temporary Automatically deleted by the system before the job ends.
Catalogued Everything except temporary is catalogued. Its name is placed in the
system catalog, like a directory, to make it easy to find it later.
Sequential Not VSAM. Records accessed sequentially, from beginning of the file onward.
No random access. No reading backwards.
Generation Type of sequential where the system assign a new name each time
you create a new file.
PDS member A subset of a PDS (Partitioned Data Set) or library. A file within a PDS or library.
PDS A file containing smaller files known as members.
VSAM A file type that is beyond the scope of this book.
Sample DD Statements for Existing data
In-stream data
//ddname DD *
data goes here
/*
Example:
//INFILE DD *
Maria
Christine
/*
Permanent disk, sequential non-gdg, non-pds member. Previously Catalogued.
//ddname DD DSN=dataset-name,DISP=SHR
Example:
//INFILE DD DSN=MY.DATASET.DATA,DISP=SHR
Tape. Previously Catalogued.
//ddname DD DSN=dataset-name,DISP=OLD
Example:
//INFILE DD DSN=MY.DATASET.DATA,DISP=OLD
Permanent disk, sequential gdg. Previously Catalogued.
//ddname DD DSN=dataset-name(0),DISP=SHR
Example:
//INFILE DD DSN=MY.DATASET.DATA(0),DISP=SHR
Permanent disk, PDS member. Previously Catalogued.
//ddname DD DSN=dataset-name(member-name),DISP=SHR
Example:
//INFILE DD DSN=MY.DATASET.DATA(M1),DISP=SHR
Temporary disk. Previously Passed
//ddname DD DSN=&&dataset-name,DISP=(OLD,DELETE) or OLD,PASS
Example:
//INFILE DD DSN=&&TEMP,DISP=(OLD,DELETE)
Tape, gdg. Previously Catalogued.
//ddname DD DSN=dataset-name(0),DISP=OLD
Example:
//INFILE DD DSN=MY.DATASET.DATA(0),DISP=OLD
File is not present.
//ddname DD DUMMY,
// DCB=(LRECL=rec-len,BLKSIZE=blk-size,RECFM=rec-format)
Example:
//INFILE DD DUMMY,
// DCB=(LRECL=80,BLKSIZE=800,RECFM=FB)
Sample DD Statements for Creating data
Spooled to printer
//ddname dd SYSOUT=printer-class
Example:
//OUTFILE DD SYSOUT=*
Permanent disk, sequential non-gdg, non-pds member. Cataloguing.
//ddname DD DSN=dataset-name,DISP=(NEW,CATLG,DELETE),
// UNIT=diskunit,SPACE=(TRK,1)
Example:
//OUTFILE DD DSN=MY.DATASET.DATA,DISP=(NEW,CATLG,DELETE),
// UNIT=SYSDA,SPACE=(TRK,1)
Tape, non-gdg. Cataloguing.
//ddname DD DSN=dataset-name,DISP=(NEW,CATLG,DELETE),
// UNIT=tapeunit
//* other parameters may be required by your company
Example:
//ddname DD DSN=MY.DATASET.DATA,DISP=(NEW,CATLG,DELETE),
// UNIT=TAPE
//* other parameters may be required by your company
Permanent disk, sequential gdg. Cataloguing.
//ddname DD DSN=dataset-name(+1),DISP=(NEW,CATLG,DELETE),
// UNIT=diskunit,SPACE=(TRK,1),
// DCB=model-dscb optional at some companies
Example:
//OUTFILE DD DSN=MY.DATASET.DATA(+1),DISP=(NEW,CATLG,DELETE),
// UNIT=SYSDA,SPACE=(TRK,1),
// DCB=MODEL.DSCB optional at some companies. find out your co's name
Permanent disk, new or existing PDS member. Existing member will be overwritten
PDS was Previously Catalogued.
//ddname DD DSN=dataset-name(member-name),DISP=SHR
Example:
//OUTFILE DD DSN=MY.DATASET.DATA(M1),DISP=SHR
Temporary disk. Passing.
//ddname DD DSN=&&dataset-name,DISP=(NEW,PASS,DELETE),
// UNIT=diskunit,SPACE=(TRK,1)
Example:
//OUTFILE DD DSN=&&TEMP,DISP=(NEW,PASS,DELETE),
// UNIT=SYSDA,SPACE=(TRK,1)
Temporary disk. Not used again in same job. A work file.
//ddname DD UNIT=diskunit,SPACE=(TRK,1)
Example:
//OUTFILE DD UNIT=SYSDA,SPACE=(TRK,1)
Tape, gdg. Cataloguing.
//ddname DD DSN=dataset-name(+1),DISP=(NEW,CATLG,DELETE),
// UNIT=tapeunit,
// DCB=model-dscb optional at some companies
Example:
//OUTFILE DD DSN=MY.DATASET.DATA(+1),DISP=(NEW,CATLG,DELETE),
// UNIT=TAPE,
// DCB=MODEL.DSCB optional at some companies. find out your co's name
Throw away the file.
//ddname DD DUMMY,
// DCB=(LRECL=rec-len,BLKSIZE=blk-size,RECFM=rec-format)
Example:
//OUTFILE DD DUMMY,
// DCB=(LRECL=80,BLKSIZE=800,RECFM=FB)
Just Examples
//* GDG1DEF DEFINE A GENERATION DATA GROUP
//GDG1DEF EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=*
//SYSIN DD *
DEFINE GDG (NAME(TSOUSR1.SAMPLE.GDG.BASE) -
LIMIT(10) NOEMPTY SCRATCH)
/*
//*GDG2MAKE ACTUALLY CREATE A NEW G. D. SET
//STEP1 EXEC PGM=IEBGENER
//SYSPRINT DD SYSOUT=*
//SYSIN DD DUMMY
//SYSUT1 DD *
JANE
MARIANNE
ANTONETTA
/*
//SYSUT2 DD DSN=TSOUSR1.SAMPLE.GDG.BASE(+1),DISP=(NEW,CATLG),
// SPACE=(TRK,1),
// DCB=model-dscb optional at some companies
//* GDG3ALT CHANGE A GENERATION DATA GROUP'S DEFINITION
//GDG3ALT EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=*
//SYSIN DD *
ALTER TSOUSR1.SAMPLE.GDG.BASE -
LIMIT(15)
/*
//* GDG4DEL THIS WILL DELETE ALL THE MEMBERS OF THE GROUP
//ADIOS EXEC PGM=IEFBR14
//BYEBYE DD DSN=TSOUSR1.SAMPLE.GDG.BASE,DISP=(OLD,DELETE)
//* THIS WILL REMOVE THE GD GROUP FROM THE CATALOG
//* BE SURE TO DO GDG3DEL FIRST
//GDG5DEL EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=*
//SYSIN DD *
DELETE TSOUSR1.SAMPLE.GDG.BASE GDG
/*
//* DEFINE A VSAM KSDS
//DEFKSDS EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=*
//SYSIN DD *
DELETE (TSOUSR1.VSAM.KSDS) CLUSTER
DEFINE CLUSTER +
NAME(TSOUSR1.VSAM.KSDS) +
CYLINDERS(1,1) +
KEYS(10,0) +
RECORDSIZE(80,80) +
INDEXED)
/*
//* DEFINE A VSAM ESDS
//DEFESDS EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=*
//SYSIN DD *
DELETE (TSOUSR1.VSAM.ESDS) CLUSTER
DEFINE CLUSTER +
NAME(TSOUSR1.VSAM.ESDS) +
CYLINDERS(1,1) +
RECORDSIZE(80,80) +
NONINDEXED)
/*
//* DEFINE A VSAM RRDS
//DEFRRDS EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=*
//SYSIN DD *
DELETE (TSOUSR1.VSAM.RRDS) CLUSTER
DEFINE CLUSTER +
NAME(TSOUSR1.VSAM.RRDS) +
CYLINDERS(1,1) +
RECORDSIZE(80,80) +
NUMBERED)
/*
//* LOAD A VSAM DATASET (KSDS, ESDS, RRDS) THEN PRINT IT
//LOADVSAM EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=*
//SYSIN DD *
REPRO INFILE(INDD) OUTDATASET(TSOUSR1.VSAM.xxxx)
PRINT INDATASET(TSOUSR1.VSAM.xxxx) CHARACTER
/*
//INDD DD *
MARIA
CHRISTINE
ANIE
SUSAN
NADIA
/*
//* COPY ONE PDS TO ANOTHER DO NOT REPLACE LIKE-NAMED MEMBERS
//LIBCOPY EXEC PGM=IEBCOPY
//SYSPRINT DD SYSOUT=*
//SYSUT2 DD UNIT=SYSDA,SPACE=(CYL,(3,3))
//SYSUT3 DD UNIT=SYSDA,SPACE=(CYL,(3,3))
//SYSUT4 DD UNIT=SYSDA,SPACE=(CYL,(3,3))
//INLIB DD DSN=library-containing-members,DISP=SHR
//OUTLIB DD DSN=library-to-put-members-in,DISP=SHR
//SYSIN DD *
COPY INDD=INLIB,OUTDD=OUTLIB
/*
//* OPTIONAL THINGS:
//*
//* TO COPY BUT EXCLUDE TWO MEMBERS:
//* COPY INDD=INLIB,OUTDD=OUTLIB
//* EXCLUDE MEMBER=(m1,m2)
//*
//* TO COPY AND REPLACE:
//* COPY INDD=((INLIB,R)),OUTDD=OUTLIB
Sometimes you need just enough information so that you can do something - it gets you started when you don’t have time to learn everything. Get all the others in the series at: Justenuf Other Books for professionals: REXX Reference All REXX verbs, keywords, and built-in functions as found in MVS, VM/CMS and OS/2. Order from MVS Training (800) 356 9093.MVS Training The REXX Language on TSO How to use REXX on TSO. Information, ordering at: REXX ISPF Services: Using the Dialogue Manager with REXX How to create ISPF panels on TSO. Examples in REXX. Information, ordering at:ISPF Services You will find a large selection of mainframe books at:Books. You’ll find manuals on TSO, JCL, REXX, COBOL, DB2 at:Manuals. About this series.
![[Books Computer]](http://www.theamericanprogrammer.com/pix/rwb2_line.gif)
|
Home
|
Programming
|
Books for Computer Professionals
|
Privacy
|
Terms
|
Contact
|
|
Site Map and Site Search
|
Programming Manuals and Tutorials
|
The REXX Files
| Top of Page
|