VSAM

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 94

MAINFRAMES

Virtual Storage Assess Method


(VSAM)

NAGARAJU DOMALA
VSAM

 Course Coverage
 VSAM Concepts
 Internal Organization
 Alternate Indexes
 AMS Commands
 VSAM Dataset allocation
 AIX Allocation
 Loading Datasets
 Print,Copy and Alter Command
 Processing KSDS w/o AIX
 Processing KSDS with AIX
 Processing ESDS, if time permits

Nagaraju Domala
Basic Concepts

 What is VSAM ?
 Virtual Storage Access Method (VSAM) is a high performance
access method used in IBM mainframe OS
 VSAM resides in Virtual Storage along with the program that
needs its services for manipulation of data on DASD
 VSAM arranges records by an index key or by relative byte
addressing.
 VSAM is used for direct or sequential processing of fixed and
variable-length records on DASD.
 Data organized by VSAM is cataloged for easy retrieval, and
is stored in one of four types of data sets.
VSAM Ver 1.0 3

Nagaraju Domala
Basic Concepts

 What is Access Method Services (AMS)?


 Is a service program that helps in allocate, maintain and delete catalogs and datasets.
 Consists of IDCAMS

 IDCAMS - Multipurpose utility


 Allocating, maintaining and deleting Catalogs
 Allocating, maintaining and deleting VSAM Datasets
 Reorganizing and Printing Datasets
 Cataloging non-VSAM datasets & GDG
 Defining page space for MVS OS

VSAM Ver 1.0 4

Nagaraju Domala
Advantages & Drawbacks Of VSAM

 Advantages
 The retrieval of records is faster because of an efficiently organized
index. The index is small because of key compression algorithm used
to store and retrieve records
 Imbedded free space makes the insertion of records easy and
therefore requires less reorganization
 The deletion of records means that they are physically deleted thus
allowing the reclaiming of free space within datasets
 Records can be accessed randomly by key or address and can also be
accessed sequentially at the same time
 VSAM datasets can be shared across partitions, regions, address space
and systems. The type and level of sharing can be controlled thru AMS
and JCL
VSAM Ver 1.0 5

Nagaraju Domala
Advantages & Drawbacks Of VSAM

 Advantages (contd)
 VSAM provides data security thru passwords protection of
datasets at various levels like read and update
 VSAM provides the ability to physically distribute datasets
over various volumes based on key ranges
 VSAM datasets are device independent
 Drawbacks
 Free spaces, hence more disk space
 Integrity of VSAM datasets in cross systems and cross regions
sharing must be controlled by the User

VSAM Ver 1.0 6

Nagaraju Domala
Types of VSAM Datasets

 Entry-sequenced data set (ESDS)


Contains records in the order in which they were entered. Records are added to the end of the data set,
and can be accessed.
 Key-sequenced data set (KSDS)
Contains records in ascending collating sequence, and can be accessed by a field,
called a key, or by a relative byte address.
 Linear data set (LDS)
Contains data that has no record boundaries. Linear data sets contain none
of the control information that other VSAM data sets do. Linear data sets
must be cataloged in an integrated catalog facility catalog.
 Relative record data set (RRDS)
Contains records in order by relative record number, and can be accessed only by this number. There
are Fixed & Variable types of relative record data sets.

VSAM Ver 1.0 7

Nagaraju Domala
Organising VSAM Datasets

 A data set consists of a data component and, additionally,


an index component for a KSDS
 Each component consists of one or more CAs
 A CA may consist of many CIs
 A CI may have one or more records
 For a data component, a record may span many CI

VSAM Ver 1.0 8

Nagaraju Domala
Control Intervals
A control interval consists of:
 Logical records
 Free space
 Control information fields.
Control Information Fields (CIDF & RDF)
Control information consists of two types of fields: one control
interval definition field (CIDF), and one or more record definition
fields (RDFs).

VSAM Ver 1.0 9

Nagaraju Domala
Control Area

 CIDFs are 4 bytes long, and contain information about the control interval, including the amount and
location of free space.
 RDFs are 3 bytes long, and describe the length of records and how many adjacent records are of the
same length. If two or more adjacent records have the same length, only two RDFs are used for this
group. One RDF gives the length of each record, and the other gives the number of consecutive
records of the same length.
 Control Areas (CA)
 The control intervals in a VSAM data set are grouped together into fixed-length contiguous areas
of direct access storage called control areas.
 A VSAM data set is composed of one or more control areas (minimum 2 CIs)
 The number of control intervals in a control area is fixed by VSAM.
 The maximum size of a control area is one cylinder, and the minimum size is one track of DASD
storage.
 Min. size of CA is one track, Max. size is one cylinder
 Free CIs may be left within CA

VSAM Ver 1.0 10

Nagaraju Domala
Control Area

 Free Space
 Free Space left within CI that is used when new records are added to
CI
 Free CI’s left within a CA that are used when new record additions
cannot fit into particular CI
 Free CA’s left within a dataset that are utilized after all the free CI’s in a
particular CA have been used and none of the CI’s in that CA can
accommodate the record being inserted
 For ESDS, free space is left only at the end of dataset
 For ESDS, no imbedded free space between CI’s or CA’s
 For RRDS, no free space is allocated
VSAM Ver 1.0 11

Nagaraju Domala
SPANNED Records

 Spanned Records
 Sometimes a record is larger than the control interval size used for a particular data set.
 In VSAM, the SPANNED parameter allows a record to extend across or span control interval
boundaries.
 Spanned records might reduce the amount of DASD space required for a data set when data
records vary significantly in length, or when the average record length is larger compared to the
CI size.

Data Set With Spanned Records

VSAM Ver 1.0 12

Nagaraju Domala
SPANNED Records

 Remember
 A spanned record always begins on a control interval boundary and fills more than
one control interval within a single control area.
 For key-sequenced data sets, the entire key field of a spanned record must be in the
first control interval.
 The control interval containing the last segment of a spanned record might also
contain unused space. You can use the unused space only to extend the spanned
record; it cannot contain all or part of any other record.
 Spanned records can only be used with key-sequenced data sets and entry-
sequenced data sets.
 To span control intervals, you must specify the SPANNED parameter when you
define your data set. VSAM decides whether a record is SPANNED or
NONSPANNED, depending on the control interval length and the record length.
 Locate mode (OPTCD=LOC on the RPL) is not a valid processing mode for spanned
records. A nonzero return code will be issued if locate mode is used.
VSAM Ver 1.0 13

Nagaraju Domala
VSAM Data Set Type
• Choosing a VSAM Data Set Type
VSAM supports these data set types: entry-sequenced (ESDS), key-
sequenced
(KSDS), linear (LDS), fixed-length and variable-length relative record
(RRDS).

Consider the following questions:


• Will you need to access the records in sequence, randomly, or both ways?
• Are all the records the same length?
• Will the record length change?
• How often will you need to move records?
• How often will you need to delete records?
• Do you want spanned records?
• Do you want to keep the data in order by the contents of the record?
• Do you want to access the data by an alternate index?
• Want to use access method services utilities with an IBM DB2 cluster?
VSAM Ver 1.0 14

Nagaraju Domala
VSAM Data Set Type
 Applications best suited to entry-sequenced data sets
 Applications that require sequential access only. It is better to use entry-sequenced data sets or
variable-length RRDSs for sequential access, because they support variable-length records and
can be expanded as records are added.
 If you wish to use an entry-sequenced data set in an online application, load the data set
sequentially by a batch program and access the data set directly by the relative byte address
(RBA).
 Applications best suited to key-sequenced data sets
 Applications that require that each record have a key field.
 Applications that require both direct and sequential access.
 Applications that use high-level languages which do not support RBA use.
 Online applications usually use key-sequenced data sets.
 You want to access the data by an alternate index.
 The advantage of key-sequenced data sets over fixed-length RRDS using direct access is ease
of programming.

VSAM Ver 1.0 15

Nagaraju Domala
VSAM Data Set Type
 Applications best suited to linear data sets
 Linear data sets are rarely used by application programs. They are the most effective for
specialized applications. For example, Data-In-Virtual (DIV) stores data in linear data sets.
 Applications best suited to relative record data sets
 Applications that require direct access only.
 Applications which there is a one-to-one correspondence between records and
relative record numbers. For example, you could assign numeric keys to
records sequentially, starting with the value 1. Then, you could access a RRDS
both sequentially and directly by key.
 Fixed-length RRDSs use less storage and are usually faster at retrieving
records than key-sequenced data sets or variable-length RRDSs.
 If the records vary in length, use a variable-length RRDS. Variable-length
RRDSs can be used for COBOL applications.

VSAM Ver 1.0 16

Nagaraju Domala
Entry Sequenced Dataset
 Sequenced in the order in which they are entered in the dataset
 No index component
 New insertions are always added to the end of dataset
 Update possible but no change of length
 Can be accessed randomly or sequentially
 No physical deletion
 Alternate index possible
 Records could be of variable length

VSAM Ver 1.0 17

Nagaraju Domala
Entry Sequenced Dataset

Entry Sequence Dataset Processing

VSAM Ver 1.0 18

Nagaraju Domala
Key-Sequenced Dataset

 Records are sequenced on key field


 Random access of records based on Key field
 Consists of two physical components
 Data Component contains the records that hold the user data including key field
 Index Component contains he key fields and pointers to the location of record to which the key
field belong
 Together in KSDS organized file are called as a Base Cluster
 The key must be:
 Unique
 In the same position in each record
 In the first segment of a spanned record
 Records can accessed randomly or sequentially
 Free space for additional records is provided at initial allocation

VSAM Ver 1.0 19

Nagaraju Domala
Key-Sequenced Dataset
Record Keys & Pointers

Index Data
Component Component

Data Record with their Unique Keys

VSAM Ver 1.0 20

Nagaraju Domala
Key-Sequenced Dataset
 No Overflow component
 Records can be of variable length
 Key field cannot be modified
 Can be accessed in a key sequence other than that of prime key field called alternate key
 Alternate key possible and need not be unique

Inserting Record in Key Sequenced Dataset

VSAM Ver 1.0 21

Nagaraju Domala
Key-Sequenced Dataset

Key Sequenced Dataset Processing

VSAM Ver 1.0 22

Nagaraju Domala
Key-Sequenced Dataset
 Free Space
 When a key-sequenced data set is defined, unused space can be scattered throughout the data
set to allow records to be inserted or lengthened. This space is called free space.
 When a new record is added to a control interval or an existing record is lengthened, subsequent
records are moved into the following free space to make room for the new or lengthened record.
 When a record is deleted or shortened, the space given up is reclaimed as free space for later
use.
 When you define your data set, you can use the FREESPACE parameter to specify what
percentage of each control interval is to be set aside as free space when the data set is initially
loaded.
 Within each control area, you can reserve free space by using free control intervals
to avoid splitting your control area when you want to insert additional records or
lengthen existing records.
 Whenyou define your data set, you can specify what percentage of the control area
is to be set aside as free space, using the FREESPACE parameter.

VSAM Ver 1.0 23

Nagaraju Domala
Key-Sequenced Dataset
 Insertion of a Logical Record in a Control Interval

VSAM Ver 1.0 24

Nagaraju Domala
Key-Sequenced Dataset

 Prime Index
 A key-sequenced data set always has a prime index that relates key values to
the relative locations of the logical records in a data set. The prime index, or
simply index, has two uses:
 To locate the collating position when inserting records
 To locate records for retrieval
 When initially loading a data set, records must be presented to VSAM in key
sequence. The index for a key-sequenced data set is built automatically by
VSAM as the data set is loaded with records.
 When a data control interval is completely loaded with logical records, free
space, and control information, VSAM makes an entry in the index.
 The entry consists of the highest possible key in the data control interval and
a pointer to the beginning of that control interval.

VSAM Ver 1.0 25

Nagaraju Domala
Relative Record Dataset

 Entire dataset is string of fixed-length slots


 Each slot occupies a fixed position and is identified by its position relative to the
first slot of the dataset
 The relative position of each slot is called the relative record number (RRN)
 Each may or may not contain record
 Can be accessed randomly or sequentially
 Designing a algorithm that can develop a relationship between record and RRN
slot
 Always fixed length records
 Only data component
 No Alternate Index
VSAM Ver 1.0 26

Nagaraju Domala
Relative Record Dataset

Fixed-length Relative Record Data Set

VSAM Ver 1.0 27

Nagaraju Domala
Relative Record Dataset

Fixed-length Relative Record Data Set

VSAM Ver 1.0 28

Nagaraju Domala
Relative Record dataset

 Variable-Length Relative Record Data Sets


 A variable-length RRDS is similar to a fixed-length RRDS, except that it contains variable-length
records. Each record has a unique relative record number, and is placed in ascending relative
record number order. Each record is stored and retrieved using its relative record number.
 Unlike a fixed-length RRDS, a variable-length RRDS does not have slots. The relative record
number of a record cannot change. When that record is erased, the relative record number
can be reused for a new record.
 You must load the variable-length RRDS sequentially in ascending relative record number order.
To define a variable-length RRDS, specify NUMBERED and RECORDSIZE. The average record
length and maximum record length in RECORDSIZE must be different.
 Free space is used for inserting and lengthening variable-length RRDS records. When a record
is deleted or shortened, the space given up is reclaimed as free space for later use. While
defining data set, use the FREESPACE parameter to specify what percentage of each control
interval and control area is to be set aside as free space when the data set is initially loaded.

VSAM Ver 1.0 29

Nagaraju Domala
Relative Record dataset

Variable-Length Relative Record Data Sets Processing

VSAM Ver 1.0 30

Nagaraju Domala
Comparison of Indexed Sequential & KSDS

Characteristics Indexed Seq. KSDS


Dataset Allocation JCL-DISP- New AMS-IDCAMS

Dataset Deletion JCL-DISP-Delete AMS-IDCAMS

AIX Support No Yes

Deleting Records Logical Delete Physical Delete

Reorg. of DS Needed more often Needed Less

Disk Space Req Less Greater

Concurrent Seq and Not supported unless Supported in one


Random access two DCB are created access control blk

VSAM Ver 1.0 31

Nagaraju Domala
Physical Sequential and ESDS

Characteristics Physical Sequential ESDS

Dataset allocation JCL-DISP-NEW AMS-IDCAMS

Dataset Deletion JCL-DISP-Delete AMS-IDCAMS

Records Altered Yes- no length change Yes

AIX Supported No Yes (up to 253)

Random Access No Yes

Supported in CICS Yes Yes

Non-DASD Support Yes No

VSAM Ver 1.0 32

Nagaraju Domala
Rec 1 Rec 2 Rec 3 Rec 4

Control Interval
Control Interval

Control Interval

Control Interval

Control Interval

Control Interval

Control Interval

Control Interval

VSAM Ver 1.0 33

Nagaraju Domala
Access of VSAM Records

 Accessing Records in a VSAM Data Set


We can use addressed-sequential and addressed-direct access for:
 Entry-sequenced data sets
 Key-sequenced data sets
We can use keyed-sequential, keyed-direct, and skip-sequential access for:
 Key-sequenced data sets
 Fixed-length RRDSs
 Variable-length RRDS
All types of VSAM data sets, including linear, can be accessed by control
interval access, but this is used only for very specific applications. CI
mode processing is not permitted when accessing a compressed data set.
The data set can be opened for CI mode processing to allow for VERIFY
and VERIFY REFRESH processing only.
VSAM Ver 1.0 34

Nagaraju Domala
Access of VSAM Records
Entry-Sequenced Data Set

 Entry-sequenced data sets are accessed by address, either


sequentially or directly. When addressed sequential
processing is used to process records in ascending relative
byte address (RBA) sequence, VSAM automatically
retrieves records in stored sequence.
 To access a record directly from an entry-sequenced data set, you
must supply the RBA for the record as a search argument.
 Skip-sequential processing is not supported for entry-sequenced
data sets.

VSAM Ver 1.0 35

Nagaraju Domala
Access of VSAM Records
Key-Sequenced Data Set

The most effective way to access records of a key-sequenced data set is by key
using the associated prime index or by one of the alternate keys using Alternate
index .
 Keyed-Sequential Access
 Sequential access is used to load a key-sequenced data set and to retrieve, update,
add, and delete records in an existing data set.
 When you specify sequential as the mode of access, VSAM uses the index to access
data records in ascending or descending sequence by key.
 Sequential processing can be started anywhere within the data set. Positioning is
necessary if your starting point is within the data set.
 Positioning can be done by * Using the POINT macro or * Issuing a direct
request, then changing the RPL with the MODCB macro from "direct" to
"sequential.”
 Sequential access allows you to avoid searching the index more than once and is
faster than direct for accessing multiple data records in ascending key order.
VSAM Ver 1.0 36

Nagaraju Domala
Access of VSAM Records
Key-Sequenced Data Set

 Keyed-Direct Access
 Direct access is used to retrieve, update, delete and add records.
 When direct processing is used, VSAM searches the index from the highest
level index-set record to the sequence-set for each record to be accessed.
 Searches for single records with random keys is usually done faster with direct
processing.
 You need to supply a key value for each record to be processed.
 For retrieval processing, you can either supply the full key or a generic key.
The generic key is the high-order portion of the full key.
 Direct access allows you to avoid retrieving the entire data set sequentially to
process a small percentage of the total number of records.

VSAM Ver 1.0 37

Nagaraju Domala
Access of VSAM Records
Key-Sequenced Data Set

 Skip-Sequential Access
 Skip-sequential access is used to retrieve, update, delete, and add records. When
skip-sequential is specified as the mode of access, VSAM retrieves selected
records, but in ascending sequence of key values.
 Skip-sequential processing allows you to:
 Avoid retrieving the entire data set sequentially to process a small percentage
of the total number of records
 Avoid retrieving the desired records directly, this causes the prime index to be
searched from the top to the bottom level for each record
 Addressed Access
 Another way of accessing a key-sequenced data set is addressed access, using the
RBA of a logical record as a search argument.
 Note that RBAs might change when a control interval split occurs or when records
are added, deleted, or changed in size.

VSAM Ver 1.0 38

Nagaraju Domala
Access of VSAM Records
Fixed-Length Relative Record Data Set

The RRN is always used as a search argument for a fixed-length RRDS.


 Keyed-Sequential Access: Sequential processing of a fixed-length RRDS is the
same as sequential processing of an entry-sequenced data set. Empty slots
are automatically skipped by VSAM.
 Skip-Sequential Access: Skip-sequential processing is treated like direct
requests, except that VSAM maintains a pointer to the record it just retrieved.
When retrieving subsequent records, the search begins from the pointer,
rather than from the beginning of the data set. Records must be retrieved in
ascending sequence.
 Keyed-Direct Access: A fixed-length RRDS can be processed directly by
supplying the relative record number (RRN) as a key. VSAM converts the
relative record number to an RBA and determines the control interval
containing the requested record. If a record in a slot flagged as empty is
requested, a "no-record-found" condition is returned.
VSAM Ver 1.0 39

Nagaraju Domala
Access of VSAM Records
Variable-Length Relative Record Data Set

The RRN is used as a search argument for a variable-length RRDS.


 Keyed-Sequential Access: Sequential processing of a variable-length RRDS is the
same as for an entry-sequenced data set. On retrieval, relative record numbers
that do not exist are skipped. On insert, if no relative record number is supplied,
VSAM uses the next available relative record number.
 Skip-Sequential Access: Skip-sequential processing is used to retrieve, update,
delete, and add variable-length RRDS records. Records must be retrieved in
ascending sequence.
 Keyed-Direct Access: A variable-length RRDS can be processed directly by
supplying the relative record number as a key. If you want to store a record in a
specific relative record position, use direct processing and assign the desired
relative record number. VSAM uses the relative record number to locate the
control interval containing the requested record. You cannot use an RBA value to
request a record in a variable-length RRDS.

VSAM Ver 1.0 40

Nagaraju Domala
Access of VSAM Records
Variable-Length Relative Record Data Set

 Relative Byte Address


 Records of KSDS or ESDS’s can be accessed
 RBA in KSDS might change because of reorg. , CI split or CA spilt.
 RBA in ESDS never changes
 Limited application as it is difficult to establish a relationship
between an RBA and a key field
 Relative Record Number (RRN)
 Fastest Access Method
 For RRDS, this is only method
VSAM Ver 1.0 41

Nagaraju Domala
Alternate Index

 Accessing Records through an Alternate Index


 We can use AMS to define and build one or more alternate indexes over a key-
sequenced or entry-sequenced data set, that is called the base cluster.
 An alternate index provides access to records by using more than one key.
 It accesses records in the same way as the prime index of a key-sequenced data
set. An alternate index eliminates the need to store multiple copies of the same
information for different applications.
 The alternate index is built from all the records in a base cluster.
 Unlike primary keys, that must be unique, the key of an alternate index can refer
to more than one record in the base cluster.
 An alternate key value that points to more than one record is nonunique. If the
alternate key points to only one record, it is unique.
 The maximum number of nonunique pointers associated with an alternate index
data record cannot exceed 32,767.
VSAM Ver 1.0 42

Nagaraju Domala
Alternate Index

 Alternate Index
 The alternate index is a key-sequenced data set; it consists of an index component
and a data component. The records in the data component contain an alternate
key and one or more pointers to data in the base cluster. For an entry-sequenced
base cluster, the pointers are RBA values.
 For a key-sequenced base cluster, the pointers are prime key values.
 Each record in the data component of an alternate index is of variable length and
contains header information, the alternate key, and at least one pointer to a base
data record. Header information is fixed length and shows:
 Whether the alternate index data record contains prime keys or RBA pointers
 Whether the alternate index data record contains unique or nonunique keys
 The length of each pointer
 The length of the alternate key
 The number of pointers.
VSAM Ver 1.0 43

Nagaraju Domala
Alternate Index

Alternate Index for Key Sequenced Dataset

VSAM Ver 1.0 44

Nagaraju Domala
ALTERNATE INDEX

SSN Empno Emp Name

Rec 1 11111 - 10 - Ranade


Rec 2 22222 - 63 - Tanaka

Rec 3 33333 - 28 - Krantz

Rec 4 44444 - 05 - Butler


Rec 5 55555 - 52 - Ranade

Prime Key Alt key 1 Alt Key 2

VSAM Ver 1.0 45

Nagaraju Domala
5 bytes Emp NO SSN

- 05 44444
- 10 11111
- 28 33333
- 52 55555
- 63 22222

KEY OF ALT PRIME kEY PTRS


INDEX CLUSTER TO BASE CLUSTER

VSAM Ver 1.0 46

Nagaraju Domala
5 bytes Emp Name SSN

- Butler 44444
- Krantz 33333
- Ranade 11111 55555
- Tanaka 22222

Key to Alt index Prime key ptrs to


base cluster

Non-Unique Alternate Key (KSDS)

VSAM Ver 1.0 47

Nagaraju Domala
Alternate Index

 Alternate Index on ESDS


 No Primary key for ESDS
 Alternate index based on RBA
 Both Unique and non-unique Alternate key possible
 Alternate Index are always KSDS , irrespective of what kind of base cluster
is
 Alternate Index Path
 Before accessing a base cluster through an alternate index, a path must be
defined. A path provides a way to gain access to the base data through a
specific alternate index. You define a path with the access method
services command DEFINE PATH.
 A path is an entry in the VSAM catalog that establishes a logical link
between an alternate index cluster and base cluster

VSAM Ver 1.0 48

Nagaraju Domala
Defining a VSAM Data Set

 Defining a VSAM Data Set


VSAM data sets are defined using either access method services commands or JCL
dynamic allocation.
1. VSAM data sets must be cataloged. If you wish to use a new catalog, use access method
services commands to create a catalog.
2. Define a VSAM data set in the catalog using the TSO ALLOCATE command, or access
method services ALLOCATE or DEFINE CLUSTER command, dynamic allocation, or JCL.
3. Load the data set with data either by using the access method services REPRO
command, or by writing your own program to load the data set.
4. Optionally, define any alternate indexes and relate them to the base cluster. Use the
access method services DEFINE ALTERNATEINDEX, DEFINE PATH, and BLDINDEX
commands to do this.
5. After any of above steps, use the access method services LISTCAT and PRINT commands
to verify what has been defined, loaded, and processed.

VSAM Ver 1.0 49

Nagaraju Domala
AMS COMMANDS

 General Usage
 DEFINE CLUSTER : Creates a catalog entry for VSAM object
 DEFINE ALTERNATE INDEX (AIX) : define alternate index for base cluster
 DEFINE PATH : Define a path to access VSAM dataset thru AIX key
 DEFINE GDG : Define a generation data group
 DELETE : Deletes one or more VSAM objects and their catalogs
 LISTCAT : Lists information contained in VSAM catalog
 PRINT : Print contents of VSAM or indexed-sequential data set (hexa or character formats)
 REPRO : Copies a VSAM or sequential or indexed-sequential dataset into another VSAM or
sequential or indexed-sequential dataset or copies catalog to another catalog
 VERIFY : Closes all open files, brings the index component up to date with data component and
verifies & corrects information in a catalog

VSAM Ver 1.0 50

Nagaraju Domala
AMS COMMANDS

 Special Usage
 ALTER : Change catalog information about an already cataloged
VSAM object
 BLDINDEX : Initially load a newly defined alternate index
 EXPORT : Unloads VSAM base cluster or AIX together with its
catalog entry into movable storage volume or alternatively copies
a user catalog and then disconnects that catalog from system’s
master catalog
 IMPORT : Defines and loads a dataset or catalog that had been
unloaded via EXPORT.
VSAM Ver 1.0 51

Nagaraju Domala
AMS Commands
Define Cluster

 Cluster Concept
 For a key-sequenced data set, a cluster is the combination of the data component and the
index component. The cluster provides a way to treat the index and data components as a
single component with its own name.
 Fixed-length RRDSs, entry-sequenced data sets, and linear data sets are considered to be
clusters without index components. To be consistent, they are given cluster names that are
normally used when processing the data set.
 Defining a Data Set Using Access Method Services
 VSAM data sets can be defined with either the DEFINE CLUSTER command or the ALLOCATE
command. When a cluster is defined, VSAM uses the following catalog entries to describe the
cluster:
 A cluster entry describes the cluster as a single component.
 A data entry describes the cluster's data component.
 For a key-sequenced data set, an index entry describes the cluster's index component.

VSAM Ver 1.0 52

Nagaraju Domala
AMS Commands
Define Cluster

 Naming a Cluster
 Specify a name for the cluster, dsname in JCL, when defining it.
 A cluster name that contains more than 8 characters must be segmented by periods; 1 to 8
characters can be specified between periods. A name with a single segment is called an
unqualified name.
 A name with more than 1 segment is called a qualified name. Each segment of a qualified
name is called a qualifier.
 You can, optionally, name the components of a cluster. If you do not explicitly specify a data or
index component name when defining a VSAM data set or alternate index, VSAM will generate a
name.
 VSAM uses the following format to generate names for both system-managed and non-system-
managed data sets:
EXAMPLE: Cluster name: SALES.REGION2.CLUSTER
Generated data name = SALES.REGION2.DATA
Generated index name = SALES.REGION2.INDEX

VSAM Ver 1.0 53

Nagaraju Domala
AMS Commands
Define Cluster

 Prerequisites of dataset allocation


 Knowledge of VSAM Catalogs
 Basic Needs for defining a cluster
 volumes
 Type ( KSDS, ESDS, RRDS)
 Space Req
 Key Length
 Record Size
 Size of CI
 Free Space
 Name

VSAM Ver 1.0 54

Nagaraju Domala
Some Commonly Used Parameters

 Name
 Cylinders, Tracks, Records : Space allocation for dataset
 Suballocation | Unique
 Suballocation indicates that the components of this VSAM dataset are to be suballocated
from an existing space on volume. A data space must exist if this parm is used
 Unique indicates that the space is to be built and assigned to each component of cluster
 Indexed/Numbered/Nonindexed/Linear - type of data organisation
 Erase/Noerase
 Erase , data component is physically deleted
 No Erase , Only entry removed from the catalog
 Freespace (CI Percent CA Percent)
 Keys (length, offset)

VSAM Ver 1.0 55

Nagaraju Domala
Some Commonly Used Parameters

 Spanned/Nonspanned
 if the max. record length is more than the CI size specified, allocation will fail
unless Spanned is specified
 Imbed
 The sequence set of the index component of a KSDS is placed on the first track
of the data component and is replicated as many times as possible
 It reduces the seek time it takes the read write head to move from the index
to the data component
 Replicate
 What Imbed does to sequence set, Replicate does for an index set.
 It forces each CI of the index set of the index component to be written on a
separate track and replicated as many times as possible
 The replication factor reduces the rotational delay
VSAM Ver 1.0 56

Nagaraju Domala
Some Commonly Used Parameters

 SHAREOPTIONS
 SHAREOPTION(cross region,cross sys)
 Cross Region
 Different regions within same CPU
 Possible values : 1 2 3 4
 Recommended value 1 or 2
 Cross System
 Different regions on multiple CPU’s
 Possible Values 3 4
 Recommended 3
 Share Option 1
 Either one user can update or many users can read the data. Ensures complete read and write
integrity

VSAM Ver 1.0 57

Nagaraju Domala
Some Commonly Used Parameters

 Share Option 2
 Allows multiple users to read a dataset at the same time one user
can update it. Provides write integrity but not read
 Share Option 3
 Multiple users can read and write at same time. NO read , write
integrity provided. User application responsible for integrity
 Share Option 4
 Same as 3, but buffer used for direct processing are refreshed
each time an i/o is performed on the dataset.

VSAM Ver 1.0 58

Nagaraju Domala
Defining A KSDS

//DEFKSDS EXEC=IDCAMS
//SYSIN DD *
DEFINE CLUSTER (NAME(EMPLOYEE.KSDS.CLUSTER) -
VOLUMES(VSAM02) -
CYLINDERS(2,1) -

CONTROLINTERVALSIZE(4096) -

FREESPACE(10,20) -

KEYS(9,0) -

RECORDSIZE(50,50) -

DATA (NAME(EMPLOYEE.KSDS.DATA) -
CISZ (4096) ) -
INDEX (NAME(EMPLOYEE.KSDS.INDEX) -
CONTROLINTERVALSIZE(1024)) -
CATALOG(VSAM.USERCAT.TWO)

VSAM Ver 1.0 59

Nagaraju Domala
Defining a ESDS

//DEFESDS EXEC=IDCAMS
//SYSIN DD *
DEFINE CLUSTER (NAME (EMPLOYEE.ESDS.CLUSTER) -
VOLUMES(VSAM02) -
CYLINDERS(2,1) -
CONTROLINTERVALSIZE(4096) -
RECORDSIZE(50,50) -
NONINDEXED -
DATA (NAME(EMPLOYEE.ESDS.DATA) )
CATALOG(VSAM.USERCAT.TWO)
VSAM Ver 1.0 60

Nagaraju Domala
Defining a RRDS

//DEFRRDS EXEC=IDCAMS
//SYSIN DD *
DEFINE CLUSTER (NAME (EMPLOYEE.RRDS.CLUSTER) -
VOLUMES(VSAM02) -
CYLINDERS(2,1) -
CONTROLINTERVALSIZE(4096) -
RECORDSIZE(50,50) -
NUMBERED -
DATA (NAME(EMPLOYEE.RRDS.DATA) )
CATALOG(VSAM.USERCAT.TWO)
VSAM Ver 1.0 61

Nagaraju Domala
REPRO

 REPRO to Load a Data Set


 The REPRO command allows to retrieve records from a sequential, indexed-
sequential, or VSAM data set and store them in VSAM format in a key-
sequenced, entry-sequenced, relative record, or a sequential data set.
 The REPRO command is also used to load data from one linear data set into
another linear data set.
 When records are to be stored in key sequence, index entries are created and
loaded into an index component as data control intervals and control areas are
filled.
 Free space is left as indicated in the cluster definition in the catalog, and, if
indicated in the definition, records are stored on particular volumes according to
key ranges.
 VSAM data sets must be cataloged. Sequential and indexed sequential data
sets need not be cataloged. Sequential data sets that are system-managed
must be cataloged.
VSAM Ver 1.0 62

Nagaraju Domala
REPRO

 REPRO to Copy a Data Set


You can use the REPRO command to do any of the following:
 Copy or merge a VSAM data set into another VSAM data set.
 Copy or merge a sequential data set into another sequential data set.
 Copy an alternate index as a key-sequenced VSAM data set.
 Copy a VSAM data set whose records are fixed length into an empty fixed-length
RRDS.
 Convert a sequential or indexed sequential data set into a VSAM data set.
 Copy a VSAM data set into a sequential data set.
 Copy a data set (other than a catalog) to reorganize it. Data sets are reorganized
automatically.
 Copy individual members of a partitioned data set or PDSE. A partitioned data set or
PDSE cannot be copied, but individual members can be copied.
VSAM Ver 1.0 63

Nagaraju Domala
Alternate Index Allocation

An alternate index is a key-sequenced data set containing index entries organized


by the alternate keys of its associated base data records. It provides another way of
locating records in the data component of a cluster. An alternate index can be
defined over a key-sequenced or entry-sequenced cluster.
 Enables to look at base cluster as it it was sequenced on a field other than prime
key field
 It is different dataset physically. Always a KSDS with its own Index and data
component.Can be created on KSDS and ESDS but not on RRDS
 Requires twice the number of I/O compared to Prime key field access
 Up to 253 AIX
 Prime key and AIX key may overlap but cannot start from same location
 Unique and Non-unique AIX key
 Must be defined on the same catalog as base cluster

VSAM Ver 1.0 64

Nagaraju Domala
Alternate Index Allocation

The sequence for building an alternate index is as follows:


 Define the base cluster, using either the ALLOCATE command, the
DEFINE CLUSTER command, or JCL.
 Load the base cluster either by using the REPRO command or by
writing your own program to load the data set.
 Define the alternate index, using the DEFINE ALTERNATEINDEX
command.
 Relate the alternate index to the base cluster, using the DEFINE
PATH command. The base cluster and alternate index are
described by entries in the same catalog.
 Build the alternate index, using the BLDINDEX command.
VSAM Ver 1.0 65

Nagaraju Domala
Alternate Index Allocation

 Command Used to Create AIX


 DEFINE AIX
 Allocate space
 BLDINDEX
 Load index
 DEFINE PATH
 Develop Bridge between AIX & Base
 Alternate Index Maintenance
 All the alternate indexes of a given base cluster that have the UPGRADE
attribute belong to the upgrade set.
 The upgrade set is updated whenever a base data record is inserted, erased, or
updated.

VSAM Ver 1.0 66

Nagaraju Domala
AIX ON A KSDS

 Base Cluster Must Exist before creating AIX


 Base Cluster must not be Empty
//DEFAIX1 EXEC PGM=IDCAMS
//SYSIN DD *
DEFINE AIX (NAME EMPLOYEE.KSDS.AIX1.CLUSTER) -
RELATE (EMPLOYEE.KSDS.CLUSTER) VOLUMES(VOL1) -

CISZ(2048) KEYS(2,35) UNIQUEKEY UPGRADE -

RECORDSIZE(16,16) FREESPACE(20,20) -

SHAREOPTION(2,3) -

DATA (NAME(EMPLOYEE.KSDS.AIX1.DATA) ) -

INDEX(EMPLOYEE.KSDA.AIX1.INDEX))

Record length of unique key alternate index = 5 + length of alt key + length of prime
key
-
VSAM Ver 1.0 67

Nagaraju Domala
Nonunique AIX on a KSDS

//DEFAIX2 EXEC PGM=IDCAMS


//SYSIN DD *
DEFINE AIX (NAME EMPLOYEE.KSDS.AIX2.CLUSTER) -
RELATE (EMPLOYEE.KSDS.CLUSTER) VOLUMES(VOL1) -

CISZ(2048) KEYS(2,35) NONUNIQUEKEY -

UPGRADE -

RECORDSIZE(29,56) -

FREESPACE(20,20) -

SHAREOPTION(2,3) -

DATA (NAME(EMPLOYEE.KSDS.AIX2.DATA) ) -

INDEX(EMPLOYEE.KSDA.AIX2.INDEX))

Record length of nonnique key alternate index =


5 + length of alt key + n * length of prime key

VSAM Ver 1.0 68

Nagaraju Domala
AIX On An ESDS

Cobol Compiler does not support AIX on ESDS in batch environment. It can be used
in CICS. Assembler Support AIX on ESDS
//ESDSAIX1 EXEC PGM=IDCAMS
//SYSIN DD *
DEFINE AIX (NAME EMPLOYEE.ESDS.AIX1.CLUSTER) -
RELATE (EMPLOYEE.ESDS.CLUSTER) -
VOLUMES(VOL1) CISZ(2048) KEYS(2,35) -
UNIQUEKEY UPGRADE RECORDSIZE(11,11) -

FREESPACE(20,20) SHAREOPTION(2,3) -
DATA (NAME(EMPLOYEE.ESDS.AIX1.DATA) ) -
INDEX(EMPLOYEE.ESDA.AIX1.INDEX))

Record length = 5 + length of alt key + 4 (RBA)

VSAM Ver 1.0 69

Nagaraju Domala
BLDINDEX

 Loads data into AlX


 Base Cluster must be allocated & loaded
 The AIX cluster must be allocated
//KSDSBLD1 EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=A
//BASE DD DSN=EMPLOYEE.KSDS.CLUSTER,DISP=OLD
//AIX1 DD DSN=EMPLOYEE.KSDS.AIX1.CLUSTER,
// DISP=OLD
//SYSIN DD *
BLDINDEX
INFILE(BASE) -
OUTFILE(AIX1) -
//*

VSAM Ver 1.0 70

Nagaraju Domala
BLDINDEX

or
//SYSIN DD *
BLDINDEX
INDATASET(EMPLOYEE.KSDS.CLUSTER)
OUTDATASET(EMPLOYEE.KSDS.AIX.CLUSTER)
//*

VSAM Ver 1.0 71

Nagaraju Domala
Define Path

 Bridge between base cluster and alternate index


 It is not a dataset
//sysin dd *
DEFINE PATH -
(NAME(EMPLOYEE.KSDS.PATH1) -
PATHENTRY(EMPLOYEE.KSDS.AIX1.CLUSTER) -
UPDATE
 Printing of Records Thru PATH
 PRINT -
INDATASET(EMPOLYEE.KSDS.PATH1) -
CHAR
The output provides the records of the base cluster in the alternate key sequence of the index
over which the path has been defined.

VSAM Ver 1.0 72

Nagaraju Domala
Define Path

 Difference between AIX and Path


An alternate index cluster is a dataset with alternate key-pointer pair
records loaded into it. Accessing it by its name gives us only these
key-pointer records. A PATH, while named like any dataset , does
not occupy any data space, because it is not a physical entity.
Accessing it by its name gives us the records of the base cluster in
the alternate key sequence.

VSAM Ver 1.0 73

Nagaraju Domala
COBOL Coding for VSAM Files
ENVIRONMENT DIVISION Entries

After identifying and describing the VSAM files in the ENVIRONMENT


DIVISION and the DATA DIVISION, process the records in the files in
the PROCEDURE DIVISION of your program.
 ENVIRONMENT DIVISION Entries for VSAM Files
Example 1: VSAM Sequential File
SELECT S-FILE ASSIGN TO SEQUENTIAL-AS-FILE
ORGANIZATION IS SEQUENTIAL
ACCESS IS SEQUENTIAL
FILE STATUS KEY IS FSTAT-CODE VSAM-CODE.

VSAM Ver 1.0 74

Nagaraju Domala
COBOL Coding for VSAM Files
ENVIRONMENT DIVISION Entries

Example 2: VSAM Indexed File


SELECT I-FILE ASSIGN TO INDEXED-FILE
ORGANIZATION IS INDEXED
ACCESS IS DYNAMIC
RECORD KEY IS IFILE-RECORD-KEY
ALTERNATE RECORD KEY IS IFILE-ALTREC-KEY
FILE STATUS KEY IS FSTAT-CODE VSAM-CODE.
Example 3: VSAM Relative File
SELECT R-FILE
ASSIGN TO RELATIVE-FILE
ORGANIZATION IS RELATIVE
ACCESS IS RANDOM
RELATIVE KEY IS RFILE-RELATIVE-KEY
FILE STATUS KEY IS FSTAT-CODE VSAM-CODE.

VSAM Ver 1.0 75

Nagaraju Domala
COBOL Coding for VSAM Files
Data DIVISION Entries

 Fixed-Length Records
The compiler determines the records to be fixed length if
 you use the RECORD CONTAINS integer clause.
 Omit the RECORD CONTAINS integer clause but define all the level-
01 record description entries associated with the file to be the same
fixed size
 Variable-Length Records
The compiler determines the records to be variable-length if
 use the RECORD IS VARYING FROM integer-1 TO integer-2)
 Omit the RECORD clause, but code multiple level-01 records that are
of different sizes, or contain an OCCURS DEPENDING ON clause.

VSAM Ver 1.0 76

Nagaraju Domala
COBOL Coding for VSAM Files
Input/Output Statements for VSAM Files

VSAM file processing involves following COBOL statements :


OPEN : Connect the VSAM data set to your COBOL program for
processing.
WRITE : Add records to a file or load a file.
START : Establish the current location in the cluster for a READ NEXT
statement. START does not retrieve a record; it only sets the current
record pointer
READ and READ NEXT : Retrieve records from a file.
REWRITE : Update records.
DELETE : Logically remove records from indexed and relative files only.
CLOSE : Disconnect the VSAM data set from your program.

VSAM Ver 1.0 77

Nagaraju Domala
COBOL Coding for VSAM Files
Input/Output Statements for VSAM Files

 File Position Indicator


 The file position indicator marks the next record to be
accessed for sequential COBOL requests.
 You do not set the file position indicator anywhere in your
program; it is set by successful OPEN, START, READ, and
READ NEXT statements.
 Subsequent READ or READ NEXT requests use the
established file position indicator location and update it.
 The file position indicator is not used or affected by the output
statements WRITE,REWRITE, or DELETE. The file position
indicator has no meaning for random processing.

VSAM Ver 1.0 78

Nagaraju Domala
COBOL Coding for VSAM Files
Input/Output Statements for VSAM Files

 Error Processing for VSAM


 All errors in processing a VSAM file, whether logical errors in your program or
input/output errors on the external storage media, return control to your COBOL
program.
 When an input/output statement operation fails, COBOL will not perform corrective
action for you; control is returned to your program.
 You choose whether your program will continue running after a less-than-severe
input/output error occurs.
 COBOL provides these ways to intercept and handle certain VSAM input/output
errors:
 End-of-file phrase (AT END).
 EXCEPTION/ERROR declarative.
 FILE STATUS clause (file status key and VSAM return code).
 INVALID KEY phrase.
VSAM Ver 1.0 79

Nagaraju Domala
COBOL Coding for VSAM Files
Input/Output Statements for VSAM Files

 Opening an Empty File


To open a file that has never contained records (an empty file):
 Use OPEN OUTPUT for ESDS files.
 Use OPEN OUTPUT or OPEN EXTEND for KSDS and RRDS files. If you have coded the file for
random or dynamic access,you can also use OPEN I-O if the file is optional.
 Initially Loading Records Sequentially into a File
Initially loading a file means writing records into the file for the first time. This is not
the same as writing records into a file that has contained records that have all been
deleted.
To initially load a VSAM file:
 Open the file.
 Use sequential processing because it is faster (ACCESS IS SEQUENTIAL).
 Use WRITE to add a record to the file.

VSAM Ver 1.0 80

Nagaraju Domala
COBOL Coding for VSAM Files
Input/Output Statements for VSAM Files

 Opening a Loaded File (a File with Records)


To open a file that already contains records, use OPEN INPUT, OPEN I-O, or
OPEN EXTEND.
 Reading Records from a VSAM File
 Use the READ statement to retrieve (READ) records from a file. To read a
record, you must have opened the file INPUT or I-O. Check the file status key
after each READ.
 Records in VSAM sequential files can only be retrieved in the sequence in
which they were written.
 Records in VSAM indexed and relative record files can be retrieved:
Sequentially : According to the ascending order of the key you are using, the
RECORD KEY or the ALTERNATE RECORD KEY, beginning at the current
position of the file position indicator for indexed files, or according to ascending
relative record locations for relative files.
VSAM Ver 1.0 81

Nagaraju Domala
COBOL Coding for VSAM Files
Input/Output Statements for VSAM Files
Randomly : In any order, depending on how you set the RECORD
KEY or ALTERNATE RECORD KEY or the RELATIVE KEY before
your READ request.
Dynamically : Mixed sequential and random.
 Updating Records in a VSAM File

VSAM Ver 1.0 82

Nagaraju Domala
COBOL Coding for VSAM Files
Input/Output Statements for VSAM Files
 Updating Records in a VSAM File (contd)

VSAM Ver 1.0 83

Nagaraju Domala
COBOL Coding for VSAM Files
Input/Output Statements for VSAM Files

 Adding Records to a VSAM File


The COBOL WRITE statement adds a record to a file, without replacing any
existing records. Check the file status key after each WRITE statement.
Adding Records Sequentially
 Use ACCESS IS SEQUENTIAL and code the WRITE statement to add records
sequentially to the end of a VSAM file that has been opened with either
OUTPUT or EXTEND.
 For indexed files, new records must be written in ascending key sequence. If
the file is opened EXTEND, the record keys of the records to be added must be
higher than the highest primary record key on the file when the file was opened.
 For relative files, the records must be in sequence. If you include a RELATIVE
KEY data-item in the SELECT clause the relative record number of the record to
be written is placed in that data item.
VSAM Ver 1.0 84

Nagaraju Domala
COBOL Coding for VSAM Files
Input/Output Statements for VSAM Files

Adding Records Randomly or Dynamically


When you write records to an indexed data set and ACCESS IS RANDOM or
ACCESS IS DYNAMIC, the records can be written in any order.
 Replacing Records in a VSAM File
 To replace records in a VSAM file, use REWRITE on a file that you have
opened for I-O.
 To replace records randomly or dynamically, the record to be rewritten need not
be read by the COBOL program. Instead, to position the record you want to
update:
 For indexed files, move the record key to the RECORD KEY data item, and
then issue the REWRITE.
 For relative files, move the relative record number to the RELATIVE KEY
data item, and then issue the REWRITE.

VSAM Ver 1.0 85

Nagaraju Domala
COBOL Coding for VSAM Files
Input/Output Statements for VSAM Files

 Deleting Records from a VSAM File


 Open the file I-O and use the DELETE statement to remove an existing
record from an indexed or relative file. You cannot use DELETE on a
sequential file.
 When ACCESS IS SEQUENTIAL, or if the file contains spanned
records, the record to be deleted must first be read by the COBOL
program. The DELETE then removes the record that was read. If the
DELETE is not preceded by a successful READ, the deletion is not
done and the status key value is set to 92.
 When ACCESS IS RANDOM or ACCESS IS DYNAMIC, the record to
be deleted need not be read by the COBOL program. To delete a
record, the key of the record to be deleted is moved to the RECORD
KEY data item and the DELETE is issued.
 Check the file status key after each DELETE statement.
VSAM Ver 1.0 86

Nagaraju Domala
PROCESSING KSDS W/O AIX

 SELECT
 OPEN
 READ
 WRITE
 START
 READ NEXT
 CURRENT RECORD POINTER (CRP)
 CONCEPTUAL POINTER valid only for Sequential request
 indicates the next record to be accessed by READ or READ NEXT
 Established by OPEN ,READ, READ NEXT or START command
 Unsuccessful OPEN, READ, READ NEXT, START - undefined CRP
 Unaffected by DELETE command

VSAM Ver 1.0 87

Nagaraju Domala
Processing KSDS with AIXs

 SELECT Statement
 ALTERNATE KEY
 WITH DUPLICATE
 OPEN & CLOSE Statements
 All the related AIXs are opened (closed) when BASE Cluster is acted upon
 Building an AIX at Base Cluster Load Time
 Status of both Base & AIX clusters after creation is Unloaded
 After loading records into Base , thru pgm, the status of ONLY base
is changed to Loaded. AIXs are still unloaded
 BLDINDEX must be used to build alternate index(s), Only then the
status is changed

VSAM Ver 1.0 88

Nagaraju Domala
Processing KSDS with AIXs

 At the time loading of records in base cluster, Parm AIXBLD may be


used to change the status at the same time
//LOADSTEP EXEC PGM=A,
// PARM=‘/AIXBLD’
MUST provide SYSPRINT DD
 Key of Reference
 Is the key in the base cluster which is currently beign used to
retrieve records
 Could be prime or one of the alternate keys.
 Only one key of reference at a time

 JCL for Alternate Indexs


 DDname for Base cluster is same as in SELECT statement
VSAM Ver 1.0 89

Nagaraju Domala
Processing KSDS with AIXs

– DDname for ALT key PATHs - convention is to suffix n ( n


= 1 to number of paths)
 If base is EMPMSTR then AIX would
 EMPMSTR1, EMPMSTR2 etc

– Make sure that the sequence of ALTERNATE KEY IS


clause has one-to one correspondence with the
sequence of DD names for the path

VSAM Ver 1.0 90

Nagaraju Domala
Generation Data Sets

A generation data set is one of a collection of successive, historically related, cataloged


data sets, known as a generation data group (GDG). Each data set within a generation
data group is called a generation data set (GDS) or generation.
 Processing Generation Data Groups
 Absolute Generation and Version Numbers
 An absolute generation and version number is used to identify a specific
generation of a generation data group.
 The generation and version numbers are in the form GxxxxVyy, where xxxx is
an unsigned 4-digit decimal generation number (0001 through 9999) and yy is
an unsigned 2-digit decimal version number (00 through 99)
 Relative Generation Number
As an alternative to using absolute generation and version numbers when
cataloging or referring to a generation, we can use a relative generation number.
For example, A.B.C(-1). A.B.C(+1), or A.B.C(0).

VSAM Ver 1.0 91

Nagaraju Domala
Generation Data Sets

 DEFINE GENERATIONDATAGROUP
 DEFINE GENERATIONDATAGROUP Parameters
DEFINE GENERATIONDATAGROUP
(NAME(entryname)
LIMIT(limit)
[EMPTY|NOEMPTY]
[OWNER(ownerid)]
[SCRATCH|NOSCRATCH]
[TO(date)|FOR(days)])
[CATALOG(catname[/password])]

VSAM Ver 1.0 92

Nagaraju Domala
Generation Data Sets

 DEFINE GENERATIONDATAGROUP Example


//DEFGDG1 JOB ...
//STEP1 EXEC PGM=IDCAMS
//GDGMOD DD DSNAME=GDG01,DISP=(,KEEP),
// SPACE=(TRK,(0)),UNIT=3380,VOL=SER=VSER03,
// DCB=(RECFM=FB,BLKSIZE=2000,LRECL=100)
//SYSPRINT DD SYSOUT=A
//SYSIN DD *
DEFINE GENERATIONDATAGROUP -
(NAME(GDG01) -
EMPTY -
NOSCRATCH -
LIMIT(255) )
/*

VSAM Ver 1.0 93

Nagaraju Domala
Generation Data Sets

 DEFINE GENERATIONDATAGROUP Example (contd)


//DEFGDG2 JOB ...
//STEP1 EXEC PGM=IEFBR14
//GDGDD1 DD DSNAME=GDG01(+1),DISP=(NEW,CATLG),
// SPACE=(TRK,(10,5)),VOL=SER=VSER03,
// UNIT=3380
//SYSPRINT DD SYSOUT=A
//SYSIN DD *
/*
VSAM Ver 1.0 94

Nagaraju Domala

You might also like