Mainframes 360
The one stop destination for System Z professionals

Monday, July 27, 2009

VSAM Tutorial – How to create a ESDS and RRDS Cluster


Q. How do you create an ESDS Object using JCL/Batch JOB?
An ESDS Cluster is a VSAM Dataset, which is similar to a sequential file. An ESDS Dataset has no Index Structure. Now, you might wonder, how to access the records of an ESDS Cluster. Well, to access a record in an ESDS Cluster, you need to know the exact address/physical location, where record lies on the Disk Volume. It’s like saying, if you had a 1000 page book, and you wanted to access the line having keyword laugh, you must know beforehand on which page no(address) laugh is.

Thus, Records in ESDS Cluster are accessed by their Physical Address. This address is called Relative Byte Address(RBA). ESDS works just like a stack/pile of books. If you add records, they always get added to the top of the pile/stack, i.e. the records get appended. Since the pile is too heavy, it is not possible to insert records in between.

Here, I’ve shown how to create an empty ESDS Cluster using IDCAMS, DEFINE CLUSTER Control statement.

----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
//MYJOB004 JOB A123,QUASAR,NOTIFY=&SYSUID                              
//STEP01 EXEC PGM=IDCAMS                                               
//SYSPRINT DD DSN=CAA0176.DEMO.JOBLOG,DISP=(OLD,KEEP,KEEP)             
//SYSIN  DD   *                                                        
  DEFINE CLUSTER(                                                      -
                 NAME(CAA0176.DEMO.ESDS)                               -
                 TRACKS(1 1)                                           -
                 RECORDSIZE(80 80)                                     -
                 NONINDEXED                                            -
                 )                                                     -
  DATA(                                                                -
                 NAME(CAA0176.DEMO.ESDS.DATA)                          -
       )                                                               
/*                                                                     
//                                                                     


In the above example, I’ve created a new ESDS Cluster with the name CAA0176.DEMO.ESDS. This ESDS Cluster will be allocated space(extents) in terms of 1 Primary Track and 1 Secondary Track. All records in this ESDS Cluster will be of length 80 bytes. Moreover, since an ESDS Cluster does not have any key, we don’t write KEYS keyword. Also, ESDS Cluster is specified using the option NONINDEXED.

Since, it has on DATA Component, only the DATA Sub-parameter has been coded. The ESDS Data component will have the name – CAA0176.DEMO.ESDS.DATA.
Q. How do you create an RRDS Object using a Batch JOB/JCL?
In a Relative Record Dataset, you must recall that each record is identified by a Relative Record Number(RRN), which is nothing but the sequence number relative to the first record.

Note : As opposed to KSDS, ESDS and RRDS support only fixed length records.

In RRDS, space is divided into fixed length slots. A slot can be either completely vacant(does not contain a record) or completely full(contains a record). Thus, you can add new records to empty slots, and delete existing records from slots which are filled.

Let’s see a simple JCL to create an RRDS Cluster :

----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
//MYJOB004 JOB A123,QUASAR,NOTIFY=&SYSUID                              
//STEP01 EXEC PGM=IDCAMS                                               
//SYSPRINT DD DSN=CAA0176.DEMO.JOBLOG,DISP=(OLD,KEEP,KEEP)             
//SYSIN  DD   *                                                        
  DEFINE CLUSTER(                                                      -
                 NAME(CAA0176.DEMO.RRDS)                               -
                 TRACKS(1 1)                                           -
                 RECORDSIZE(80 80)                                     -
                 NUMBERED                                              -
                 REUSE                                                 -
                 )                                                     -
  DATA(                                                                -
                 NAME(CAA0176.DEMO.RRDS.DATA)                          -
       )                                                               
/*                                                                     
//                                                                     


RRDS is created on the same lines, like how we created an ESDS. The only difference being that since RRDS records are accessed by RRN(Sequence Number), we must code NUMBERED inside the DEFINE CLUSTER AMS Command.

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.