RRDS is abbreviated as Relative Record Data Set. RRDS cluster is similar to an ESDS cluster. The only difference is that RRDS records are accessed by Relative Record Number (RRN), we must code NUMBERED inside the DEFINE CLUSTER command. Following are the key features of RRDS.
A Relative record dataset has records that are identified by the Relative Record Number (RRN), which is the sequence number relative to the first record.
RRDS allows access of records by number like record 1, record 2, and so on. This provides random access and assumes the application program has a way to get the desired record numbers.
The records in an RRDS dataset can be accessed sequentially, in relative record number order, or directly, by supplying the relative record number of the desired record.
The records in a RRDS dataset are stored in fixed length slots. Each record is referenced by the number of its slot, number can vary from 1 to the maximum number of records in the dataset.
Records in a RRDS can be written by inserting new record into an empty slot.
Records can be deleted from an RRDS cluster, thereby leaving an empty slot.
Applications which use fixed-length records or a record number with contextual meaning that can use RRDS datasets.
RRDS can be used in COBOL programs like any other file. We will specify the file name in JCL and we can use the KSDS file for processing inside program. In COBOL program specify file organization as RELATIVE and you can use any access mode (Sequential, Random or Dynamic) with RRDS dataset.
Space is divided into fixed length slots in RRDS file structure. A slot can be either completely vacant or completely full. Thus, new records can be added to empty slots and existing records can be deleted from slots which are filled. We can access any record directly by giving Relative Record Number. Following example shows the basic structure of data file.
Relative Record Number | Data Field |
---|---|
1 | Record 1 |
2 | Record 1 |
3 | Record 1 |
4 | Record 1 |
DEFINE CLUSTER (NAME(rrds-file-name) - BLOCKS(number) - VOLUMES(volume-serial) - NUMBERED - RECSZ(average maximum) - [FREESPACE(CI-Percentage,CA-Percentage)] - CISZ(number) - [READPW(password)] - [FOR(days)|TO(date)] - [UPDATEPW(password)] - [REUSE / NOREUSE]) - DATA - (NAME(rrds-file-name.data)) |
The syntax parameter description remains the same as we explained in VSAM - Define Cluster Syntax chapter.
Following example shows how to create an RRDS cluster in JCL using IDCAMS utility.
//JOBNAME1 JOB CLASS=C,PRTY=10,MSGCLASS=C,MSGLEVEL=(1,1),NOTIFY=&SYSUID //* //STEP001 EXEC PGM=IDCAMS //SYSPRINT DD SYSOUT=* //SYSIN DD * DEFINE CLUSTER ( - NAME(racfid.VSAM.RRDSFILE.TEST) - NUMBERED - RECSZ(80 80) - TRACKS(1,1) - REUSE - FREESPACE(5 5) ) - DATA ( - NAME(racfid.VSAM.RRDSFILE.TEST.DATA)) /* |
If you execute the above JCL. Job should complete successfully with MAXCC = 0 and it will create racfid.VSAM.RRDSFILE.TEST VSAM file.
RRDS cluster is deleted using IDCAMS utility. DELETE command removes the entry of the VSAM cluster from the catalog and optionally removes the file, thereby freeing up the space occupied by the object.
DELETE data-set-name CLUSTER [ERASE / NOERASE] [FORCE / NOFORCE] [PURGE / NOPURGE] [SCRATCH / NOSCRATCH] |
The syntax parameter description remains the same as we explained in VSAM - Delete Cluster Syntax chapter.
Following example shows how to delete an RRDS cluster in JCL using IDCAMS utility.
//JOBNAME1 JOB CLASS=C,PRTY=10,MSGCLASS=C,MSGLEVEL=(1,1),NOTIFY=&SYSUID //* //STEP001 EXEC PGM=IDCAMS //SYSPRINT DD SYSOUT=* //SYSIN DD * DELETE racfid.VSAM.RRDSFILE.TEST CLUSTER /* |
If you execute the above JCL. Job should complete successfully with MAXCC = 0 and it will delete racfid.VSAM.RRDSFILE.TEST VSAM Cluster.
If you have any doubts or queries related to this chapter, get them clarified from our Mainframe experts on ibmmainframer Community!