Mainframes 360
The one stop destination for System Z professionals

Friday, July 3, 2009

JCL Tutorial – 08 : DD Statement – Part III

Q. I know that the DD Statement tells, what’s the Input file or Output File. However, on computer storage how does the MVS know where to find your file? How do you specify the location of your dataset? Its like searching for a needle in a haystack!
Yeah good question! The Mainframe Computer stores thousands of files(Datasets) in different areas of Memory(Storage). Each data-set is stored at a different location. Who keeps track of, where a data-set is stored? The System Catalog.

The System Catalog is special data-set(file) that acts as the address book of the MVS Operating System. The System Catalog contains an entry for all the datasets on a Mainframe Computer. It stores the name of the dataset, followed by the actual physical location of the dataset. Should you need the phone no. of your friend, you quickly search through the contact list/address-book that you maintain. Similarly, you wanna find a data-set, better search in the System Catalog.

Well, those datasets whose location has been recorded in the System Catalog, are called Cataloged Datasets. Datasets whose location is not tracked by the System Catalog, are called Uncataloged Datasets.

Cataloged Datasets :- When a DD Statement mentions an input or output file, that has been cataloged, MVS can easily find its place of residence(address) from the System Catalog.

Uncataloged Datasets :- When a DD Statement refers to and Input or Output Dataset, whose location has not been registered in the System Catalog, you must tell the location of the dataset manually.

Now-a-days, whenever you create datasets in TSO, all the datasets are automatically cataloged. This implies that you can find the dataset, merely by its name. However, formerly, if you had to specify the location of the dataset manually, you had to use the UNIT and VOL(Volume) parameters of the DD Statement.
Q. What is the UNIT Parameter?
A. Sometimes, the Input Dataset from which we want to read Data Records may be located on a TAPE Drive. Also, when IBM Mainframe Servers are installed(a process called as SYSGEN), different I/O Devices are assigned an Address. This device address uniquely identifies the device.

Apart from this, similar devices are grouped together and sometimes assigned a symbolic name.

UNIT parameter can be used to identify a device, by the device address, symbolic name or mentioning TAPE(for tape drive).  

//   DISP=SHR,

This implies, that the input dataset TRGD56.DEMO.INPUT is located on the device group whose symbolic name is SYSDA.

The UNIT parameter has AFF(Affinity) sub-parameter. To use the same unit, that has been used by a prior DD Statement, AFF sub-parameter is used.


Q. What is the VOL(VOLUME) Parameter used for?
The VOL parameter is used to specify disk volume on which the Input and Output datasets reside. The VOL parameter has several sub-parameters.

SER Specifies the serial number of the device. Every device has a serial number by which it can be identified.
REF Used to refer back to a VOL in a previous job-step.
PRIVATE Allows access to this disk volume by only 1 user.
RETAIN Prevents the volume from being dismounted, till the Batch JOB ends. 
SEQ The SEQ sub-parameter allows you to tell the MVS O/S, in what order, or in what sequence the volumes should be mounted. This is applicable only if the dataset is very large and occupies multiple volumes.

Let’s see some examples.

//   VOL=VOL1

In the above example, the dataset resides on the volume VOL1. Now, lets see another example wherein, the dataset resides on 3 volumes.

//   VOL=(VOL1,VOL2,VOL3)

In the above example, the dataset TRGD56.DEMO.INPUT resides on all the 3 volumes VOL1, VOL2 and VOL3. This requests the MVS O/S to mount all the three volumes at the same time.

//   VOL=SER=T02947

Here, the Output dataset will be created on the tape drive, whose serial number is T02947.

//   VOL=(,RETAIN,SER=T02947)

Here, the Output dataset will be created on the device serial number T02947, and this volume will not be dismounted until the Batch JOB ends.
Q. What is the LABEL parameter used for?
Whenever tape datasets are used as Input Dataset or Output Dataset, LABEL parameter can be used.

//   LABEL=1

Q. What is the SPACE parameter used for?
When we create a new dataset, we would like to specify, how much storage space to reserve for the dataset. Storage Space Allocation can be specified using the SPACE parameter.

Firstly, we must specify the unit of memory. We can specify it as BLKS(Blocks), TRKS(Tracks), CYL(Cylinders), KB(Kilotbytes) or MB(MegaBytes).

Secondly, we must specify space we need - (primary-space,extra-space).
Thus, if we specify the space as


Primary Space = 10 Tracks.
Secondary Space = 2 tracks.

What the MVS Operating System does is, it reserves 10 tracks(primary) of space for the dataset initially to begin with. Let’s day, you have made a dataset, and stored data. Over a period of time, as more and more data is added to the file, it gets inflated, and grows in size. At some point, 10 tracks of space falls insufficient for the data. Thus, the MVS allocates an extra-space of 2 tracks to the continously growing dataset. Again, when the dataset runs out of space, the MVS Operating allocates another 2 tracks of extra space to it. This way, the MVS can allocate the extra-space upto 15 times.

Thus, as a dataset grows bigger in size over a period of time, the maximum space it could get is Primary + 15 times Extra-space = 10 + 2 x 15 = 40 tracks. To begin with, the size of the dataset is 10 tracks, as the dataset gets filled over time, it grows(as extra-space of 2 tracks is given to it each time) 12, 14, 16, ..., upto maximum 40 tracks.

The SPACE Parameter also has sub-parameters like RLSE, MXIG, CONTIG and ROUND.

RLSE RLSE sub-parameter instructs the MVS O/S to release the previously allocated space, but which remained unused.
CONTIG CONTIG sub-parameter instructs the MVS O/S to allocate contiguous space.
MXIG MXIG sub-parameter instructs the MVS O/S to allocate the largest possible chunk of contiguous storage space.
ROUND ROUND sub-parameter instructs the MVS O/S to allocate the entire cylinder for the storage of the dataset.
Q. What is the DCB(Data Control Block) Parameter used for?
The DCB parameter is used to specify the organization of records within the dataset. The DCB Parameter has 4 sub-parameters :

RECFM This is used to specify the Record Format. It can be Fixed F, Fixed Blocked FB, Variable V, Variable Blocked VB, Uniform U
LRECL It stands for Logical Record Length. It is used to specify the length of the record.
BLKSIZE This is used to specify the size of the Block. A block is the unit of I/O Transfer. BLKSIZE must be a multiple of LRECL.
DSORG Dataset Organisation. It is used tell the MVS O/S whether the given dataset, is a PS(Physical Sequential File), PO(Partitioned Organized) – A directory in which each file is PS, IS(Indexed Sequential) or DA(Direct Access).

Let’s understand the DCB parameter with the help of an example.

//   SPACE=(TRKS,(1,1),RLSE)

To many people who are thrown to work at a mainframe computer on their first job, they feel lost. Mainframe people seem to speak a completely different language and that doesn't make life easy. What's more, the books and manuals are incredibly hard to comprehend.

"What on earth is a Mainframe?" is an absolute beginner's guide to mainframe computers. We'll introduce you to the hardware and peripherals. We'll talk about the operating system, the software installed on a mainframe. We'll also talk about the different people who work on a mainframe. In a nutshell, we'll de-mystify the mainframe.

Readers based in India, can buy the e-book for Rs. 50 only or the print book. International readers based in the US and other countries can click here to purchase the e-book.