0% found this document useful (0 votes)
51 views

Virtual Storage Access Method (VSAM)

VSAM (Virtual Storage Access Method) is an access method used to organize and store data on direct access storage devices (DASD) in IBM mainframe systems. It supports various data set organizations like key-sequenced data sets (KSDS), entry-sequenced data sets (ESDS), relative record data sets (RRDS), variable relative record data sets (VRDS), and linear data sets (LDS). Records in VSAM data sets are stored in units called control intervals (CIs) which contain logical records, unused space, and control information. The control information includes a control interval definition field (CIDF) and one or more record definition fields (RDFs). VSAM uses catalogs to store

Uploaded by

Akash Kumar
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
51 views

Virtual Storage Access Method (VSAM)

VSAM (Virtual Storage Access Method) is an access method used to organize and store data on direct access storage devices (DASD) in IBM mainframe systems. It supports various data set organizations like key-sequenced data sets (KSDS), entry-sequenced data sets (ESDS), relative record data sets (RRDS), variable relative record data sets (VRDS), and linear data sets (LDS). Records in VSAM data sets are stored in units called control intervals (CIs) which contain logical records, unused space, and control information. The control information includes a control interval definition field (CIDF) and one or more record definition fields (RDFs). VSAM uses catalogs to store

Uploaded by

Akash Kumar
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 49

Virtual Storage Access Method (VSAM)

Table of Contents

1. Introduction to VSAM___________________________________5
VSAM overview_________________________________________________5 What is VSAM?_________________________________________________5 Catalog Management_____________________________________________5 Record management_____________________________________________5 Advantages of VSAM_____________________________________________ !isadvantages of VSAM__________________________________________

2. VSAM Terminology_____________________________________7
"ogical record___________________________________________________# $h%sical record__________________________________________________# Control interval_________________________________________________# Control area____________________________________________________& S'lits__________________________________________________________& S'anned records_________________________________________________( Relative )%te address____________________________________________*+ Com'onent____________________________________________________*+ Cluster________________________________________________________*, -e%s__________________________________________________________*, S'here________________________________________________________*. Alternate inde/es_______________________________________________*. Alternate inde/ 'aths____________________________________________*0

3. VSAM Data set Types__________________________________15


1ntr% se2uenced data set (1S!S)__________________________________*5 -e%ed se2uenced data set (-S!S)_________________________________* Relative record data set (RR!S)___________________________________*& 3%'ical RR!S 'rocessing________________________________________,+ Varia)le relative record data set (VRR!S)__________________________,* "inear data set ("!S)____________________________________________,* Com'aring VSAM data set organi4ations___________________________,. Choosing a VSAM data set t%'e___________________________________,0

. Accessing VSAM data__________________________________2!


5!CAMS______________________________________________________,&

Access Method Services (AMS)____________________________________,& !533671SA___________________________________________________,( !efining VSAM data sets_________________________________________,( 8sing 5!CAMS_________________________________________________,( CA si4e________________________________________________________.+ 9ree s'ace o'tions______________________________________________.+ 5M:1! and R1$"5CA31________________________________________.*

5. Access Met"od Ser#ices $AMS% & ID'AMS_________________32


;C" for 5!CAMS ______________________________________________., :asic 5!CAMS Commands_______________________________________., !195<1 Command_____________________________________________., !195<1 C"8S31R =__________________________________________., R1C6V1R> 7 S$11!___________________________________________.5 S$A<<1!_____________________________________________________.5 -1>RA<?1S__________________________________________________.5 6R!1R1!____________________________________________________. R18S1________________________________________________________. R1$"5CA31___________________________________________________. V6"8M1S____________________________________________________. 5M:1!_______________________________________________________.# Share o'tion ___________________________________________________.# 1RAS1 7 <61RAS1____________________________________________.& M6R1 AMS C6MMA<!S______________________________________.& R1$R6_______________________________________________________.& 1@$6R375M$6R3_____________________________________________.( V1R59>_______________________________________________________.( "5S3CA3_____________________________________________________0+ A"31R_______________________________________________________0+ !1"131______________________________________________________0+ A5@ A !isadvantages____________________________________________0* -1>S_________________________________________________________0. R1C6R! S5B1________________________________________________00 6ther A5@ 'arameters___________________________________________00 Alternate 5nde/ for 1S!S________________________________________05 $ath = A5@ = :ase Cluster relation_________________________________05

__________________________________________________ 5
C6:6" C VSAM______________________________________________0 S3AR3 statement_______________________________________________0& R1WR531_____________________________________________________0& WR531_______________________________________________________0& C"6S1_______________________________________________________0(

VSAM

Introduction to VSAM

*D 5ntroduction to VSAM
VSAM overview
In the early 1970s, IBM introduced a collection of three data set organizations sequential, indexed, and direct-access, together with the access syste s# $his collection of data set organizations is called the %irtual &torage 'ccess Method (%&'M)# $he word *irtual relates to the fact that %&'M was introduced at a""roxi ately the sa e ti e as the initial IBM *irtual storage o"erating syste s +&,%&1 and +&,%&-# %&'M was de*elo"ed to re"lace the Indexed &equential 'ccess Method (I&'M), which is a o*erheads, which IBM wanted to i "ro*e# uch older technology# I&'M has a.or "rocessing ethods and utilities to !e used on the ainfra e o"erating

What is VSAM?
%&'M is one of se*eral access ethods that define the technique !y which data is stored and retrie*ed# It a direct access storage de*ice (3'&3) to an a""lication ust !e is a /0$,12$ interface used to transfer data fro

"rogra # VSAM does not support data stored on tape# %&'M is used to organize and access data, and aintain infor ation a!out this data, which is stored or referenced in a catalog# %&'M data sets cataloged in an integrated catalog facility (I45) structure# 6ecords are arranged !y an index 7ey or !y relati*e !yte addressing# %&'M uses direct or sequential "rocessing of fixed and *aria!le length records on 3'&3# $here are two a.or "arts to %&'M8 catalog anage ent and record anage ent#

Catalog Management
$he catalog, which contains infor ation a!out the data sets, can !e an I45 or a %&'M catalog# 35&M&,M%& deals only with I45 catalogs# 'll %&'M data sets !oo7, we will not go into detail on catalog anage ent# ust !e defined in an I45 catalog# In this

Record management
$he "ur"ose of record syste anage ent is to aintain records in a %&'M data set for an a""lication or a

"rogra # $oday, %&'M su""orts fi*e data set organizations8

- 9ey-sequenced data set (9&3&) - 0ntry-sequenced data set (0&3&) - 5ixed-length relati*e record data set (663&) - %aria!le-length relati*e record data set (%663&) - :inear data set (:3&)

CSC India

Version 1.0

Page 5 of 49

VSAM

Introduction to VSAM

$he "ri ary difference !etween the %&'M data set organizations is the way in which their records are stored and accessed#

Advantages of VSAM
+ne ethod to su""ort all ty"es of data retrie*al

4an !e a stand alone file or within a 3BM& &u""orts fixed and %aria!le 6ecords +ne utility, I34'M&, to I&'M files) &u""orts alternate index 3e*ice Inde"endence (0=1+6$ and IM1+6$) 1orta!le across syste s Modular, catalog contains all the infor ation 4atalogs are "rotected !y internal security anage e*erything (I0B/0;06 for seq files, I0B4+1< for 13&, I0BI&'M for

!isadvantages of VSAM
6equire lot of 3'&3 s"ace 5or 9&3&, "ri ary 7ey cannot !e changed 1erfor ance can !e slow !ecause of co "lexity of Index +nly resides on 3I&9

CSC India

Version 1.0

Page 6 of 49

VSAM

VSAM Terminology

,D VSAM 3erminolog%
Before we discuss %&'M data set organizations in detail, we need to introduce so e ter s that will !e used throughout the !oo7#

"ogical record
:ogical records in %&'M data sets are stored differently than logical records in non-%&'M data sets# ' logical record is a unit of infor ation used to store data in a %&'M data set# $he ter s logical record and record are used interchangea!ly in this !oo7#

$h%sical record
' "hysical record is de*ice de"endent and calculated !y catalog at the ti e the data set is defined# %&'M uses a control inter*al as its s allest unit of infor ation to transfer

Control interval
:ogical records are contained in a control inter*al (4I)# $he funda ental !uilding !loc7 of e*ery co "onent of a %&'M data set is the control inter*al# ' control inter*al is the unit of infor ation that %&'M transfers !etween the storage de*ice and the "rocessor# +ne 4I can !e 3'&3# ' 4I consists of the following8 :ogical records stored fro !eginning to end ade of one or ore "hysical !loc7s of

2nused s"ace, referred to as free s"ace, for data records to !e inserted into or lengthened 4ontrol infor ation, which is "er 4I, and one or - 4I35 is a ?-!yte field# It contains infor ation a!out the length of data in the 4I and the a ount and location of free s"ace# - 635 is a @-!yte field# It descri!es the length of records and how any ad.acent records are of the sa e length# ade u" of two ty"es of fields> one control inter*al definition field (4I35) ore record definition fields (635) "er logical record#

Figure 2-1 shows the general format of a CI.

LR1

LR2

LRn

UNUSED SPACE

R D Fn

R D F2

R D F1

C I D F

4ontrol Infor ation 5ields LR = Logical record RDF = Record definition field CIDF = Control inter al definition field

CSC India

Version 1.0

Page 7 of 49

VSAM 635 exa "les ' 1A0 ' B0 ' B0 B 1A0 B 100 B B0 4 1A0 4 -00 4 B0 5ree &"ace 635 -00 3 1A0 right to left 635 @ 635 100 635 1A0 635 @ 635 1A0 635 B0

VSAM Terminology

635 B0

6ead 635 !ac7wards, fro

95? ,=,D R!9 1/am'les $he 4I co "onents and "ro"erties @ C3ata set ty"esD for ay *ary de"ending on the data set organization# 5or exa "le, an :3& one data set to another, !ut all the 4Is and or you

does not contain 4I35s and 635s in its 4I# 'll of the !ytes in the :3& 4I are data !ytes# 6efer to cha"ter ore details# $he size of 4Is can *ary fro within the data co "onent of a "articular data set ust !e of the sa e length# 6efer to -#B, C4o "onentD

for details on the data co "onent# <ou can request the 4I size using the 'M& 305I;0 co your storage ad inistrator#

can let %&'M deter ine the 4I size, or you can s"ecify a data class, there!y using the 4I&IE0 defined !y

Control area
' control area (4') is two or $he axi u ore 4Is "ut together into fixed-length contiguous areas of 3'&3# ' %&'M ore 4's# $he nu !er of 4Is in a 4' is fixed !y %&'M# ini u size is one trac7# $he 4' size is i "licitly data set is co "osed of one or

size of a 4' is one cylinder and the

defined when you s"ecify the size of a data set at data set definition.

S'lits
4I and 4' s"lits occur as a result of data record insertions# If a record is to !e inserted and there is not enough free s"ace in the 4I, the 4I will !e s"lit# '""roxi ately half of the records in the 4I are transferred to a free 4I and the record to !e inserted is "laced in the original 4I# If there are no free 4Is and a record is to !e inserted, a 4' s"lit occurs# $he "hysical sequence of records and 4Is is no longer the sa e as the logical sequence after a s"lit# ' new index entry is inserted in the sequence set for the new 4I, and the existing index entry is u"dated#

CSC India

Version 1.0

Page 8 of 49

VSAM

VSAM Terminology

:efore control interval s'lit


Se!"ence Set I 0 M 6ecord 4 100

Data Component

0 6ecord ' 6ecord F -00

Record B 6ecord 9

Record F 5&14

Record G

U & 100 2 & 2 &

CF

45

5&14

45

After control interval s'lit


Se!"ence Set Data Component 0 0 6ecord B 6ecord 9 6ecord / I -00 6ecord 4 M 100 5&1 4 2 & 2 & 2 & 45

0 6ecord ' 100 6ecord F -00 6ecord 5

5&14

45

5&14

45

95? ,=.D :efore and After C5 S'lits

S'anned records
&"anned records are records that are larger than the 4I size# In order to ha*e s"anned records the file ust !e defined with the &1';;03 attri!ute at the ti e it is created# &"anned records are allowed to extend across or s"an control inter*al !oundaries# $he 635Gs will descri!e whether the record is s"anned or not# ' s"anned record ust always !egin on a control inter*al !oundary and fills one or ore control inter*als within a single control area# ' s"anned record cannot share the 4I with any other records# In other words, the free s"ace at the end of the last seg ent will not !e filled with the next record# $his free s"ace can only !e used to extend the s"anned record# If s"anned records are used for 9&3&, the "ri ary 7ey ust !e within the first control inter*al#

CSC India

Version 1.0

Page 9 of 49

VSAM

VSAM Terminology

Relative )%te address


$he relati*e !yte address (6B') is used to deter ine the "osition of a record in a %&'M data set# It is the "hysical location of a logical record contained in a data set# $he 6B' is the offset of a logical record fro the !eginning of the data set# $he first record in the %&'M data set has an 6B' of zero> the second record has an 6B' equal to the length of the first record, and so on# $he 6B' of a logical record de"ends only on the recordHs "osition in the sequence of records# $he 6B' is always ex"ressed as a fullword !inary integer# $he 6B' of a record includes the free s"ace and control infor ation in the 4I# 6B's ight change when a control inter*al s"lit occurs or when records are added, deleted, or changed in size# Iith co "ressed data sets, the 6B's for co "ressed records are not "redicta!le# $herefore, access !y address is not suggested for nor al use# 4I ' B0 B ?0 4 J0

6B' of B is B0 95? ,=0D 1/am'le for R:A

Com'onent
' co "onent is a na e gi*en to the indi*idual "arts of a %&'M data set# 9&3& and %663& ha*e data and index co "onents# 0&3&, 663& and :3& ha*e only data co "onents#

!ata com'onent
$he data co "onent is the "art of a %&'M data set, alternate index, or catalog that contains the data records#

5nde/ com'onent
$he index co "onent is a collection of logically sequenced 7eys# $he 7ey is a *alue ta7en fro defined field in each logical record# $he 7ey deter ines the recordGs "osition in the data set# 2sing the index, %&'M is a!le to rando ly retrie*e a record fro search of a 7ey# ' %&'M index can consist of the data co "onent when a request is ade for a record with a certain 7ey# %&'M di*ides the index 4I into sections in order to s"eed u" the ore than one le*el# 0ach le*el contains "ointers to the next lower le*el# $he index co "onent consists of two "arts8 sequence set and index set# a fixed

CSC India

Version 1.0

Page 10 of 49

VSAM

VSAM Terminology

Se2uence set
$he sequence set is the lowest le*el of index 4Is and directly "oints to the data 4I in the 4'# $here is one 4I in the sequence set for each data 4'# It contains "ointers and highest 7ey infor ation for each data 4I# It also contains horizontal "ointers fro (see 5igure --A)# one sequence set 4I to the next higher 7eyed sequence set 4I

5nde/ set
$he index set is the re ainder of the index co "onent# If there is ore than one sequence set 4I, %&'M

auto atically !uilds another index le*el# 0ach 4I in the index set contains "ointers and highest 7ey infor ation for 4is in the next lower le*el of the index# &ee 5igure --A# $he highest le*el of the index always contains a single index 4I#

5nde/ C Se2uence Set


5n de/ e% $ tr e% 5nde/ C om 'onent Se2uence Set *
e% $ tr e% $ tr e% $ tr

$ tr

DDD

Set

Se2uence Set ,
e% $ tr e% $ tr e% $ tr

Se2uen ce
DDD

Set

! ata C om 'onent

C 5*

C 5, C 5.

C 50

C 55 C 5

DDD

C ontrol A reas

C ontrol A rea *

C ontrol A rea ,

5 n d e /S e t , ( * # . , ( & & 0 , ( (

9 in dr e c, & S e 2 u e n c eS e t . # ! a t aC 5 & &

&

* .

* #

. *

. .

. 5

0 ,

95? ,=5D 5nde/ and Se2uence SetsD

CSC India

Version 1.0

Page 11 of 49

VSAM

VSAM Terminology

Cluster
'll the %&'M data set ty"es are defined as clusters# I;30=CLUSTER 3'$' 95? ,= D VSAM Com'onents 5or a 9&3&, a cluster is the co !ination of a data co "onent and an index co "onent# $he Kcluster "ro*ides a way to treat index and data co "onents as a single co "onent with its own na e# <ou can also gi*e each co "onent a na e, and "rocess the data "ortion se"arately fro the index "ortion# 663&, 0&3&, and :3& for ats are considered to !e clusters without index co "onents# $o !e consistent, they are gi*en cluster na es that are nor ally used when "rocessing the data set# 5igure --7 shows the co "onents of a 9&3&#

INDEX Component Control Interval

Control Interval

Control Interval

Index &et

Control Interval

Control Interval

Control Interval

Sequence set Control Interval

DATA Component
CONTRO L AREA

FI# 2$%&

Com'onents of a -S!S

-e%s
$o differentiate !etween 7eys used in %&'M +!.ects, the 7ey used in a !ase cluster is called a "ri ary 7ey or !ase 7ey# $he 7ey used in an alternate index is called an alternate 7ey# In %&'M 7ey sequenced organization, a record ust ha*e a unique, i !edded fixed-length "ri ary 7ey located in the sa e "osition ini u of one !yte and a axi u of -AA !ytes# ore than ust !e unique, identical alternate 7eys Version 1.0 ay occur in within each logical record# 1ri ary 7eys can !e a 2nli7e the "ri ary 7eys, which CSC India

Page 12 of 49

VSAM

VSAM Terminology

one logical record# $his allows the search with a gi*en alternate 7ey to read all !ase cluster records containing this alternate 7ey#

S'here
' s"here is a %&'M cluster and its associated data sets# $hese data sets are the alternate indexes ('I=s) of the cluster# 'n 'I= is a 9&3& containing index entries organized !y the alternate 7eys of its associated !ase data records# It "ro*ides another way of locating records in the data co "onent of a cluster# 'n 'I= can only !e defined o*er a 7ey-sequenced or entry-sequenced cluster#

Alternate inde/es
'I=s ena!le the logical records of an 0&3& or of a 9&3& (in this context called a !ase cluster) to !e accessed sequentially and directly !y data in different sequences in ore than one 7ey field# $his eli inates the need to store the sa e ay also o*erla" the "ri ary 7ey (in a 9&3&), or ulti"le data sets for the "ur"oses of *arious a""lications# 'ny field in the ust !e a contiguous field with the sa e offset in each an

!ase cluster record can !e used as an alternate 7ey# It with any other alternate 7ey# $he alternate 7ey field record# In a s"anned record, this field

ust !e located totally in the first control inter*al# 0ach alternate

index consists of an index co "onent and a data co "onent# $hese two co "onents together for

alternate index for the !ase cluster# It is a 9&3& !uilt !y %&'M# 'n alternate index will contain the different alternate 7ey *alues of a certain alternate 7ey# 5or e*ery alternate 7ey field, a different alternate index is needed# $he records in the data co "onent contain an alternate 7ey and one or !ase cluster, the "ointers are "ri e 7ey *alues# $here ay !e ore "ointers to data in the !ase cluster# 5or an entry-sequenced !ase cluster, the "ointers are 6B' *alues# 5or a 7ey-sequenced ore than one "ri ary 7ey or 6B' "er alternate 7ey# $he "ri ary 7eys or 6B's will !e in ascending sequence within an alternate index record after loading# $his fact will not necessarily !e true after the !ase cluster has !een u"dated (es"ecially the alternate 7ey fields) or new records added, as any new "ri ary 7ey or 6B' will !e inserted at the end of the a""ro"riate alternate index record# $he 'M& "rogra allows you to define, and then to create 'I=s when the B:3I;30= co and is s"ecified# 'n 'I= is defined only after its associated !ase cluster has !een defined, and it can !e !uilt only after its !ase has !een loaded with at least one record#

The BLDINDEX command causes a sequential scan of the specified base cluster, during which alternate key values and primary keys (for a KSDS) or record RBAs (for an ESDS) are extracted and put together to form alternate index records. These records are sorted by ascending alternate keys. The alternate index records are then constructed and written. VSAM maps alternate Index field to RBA of the record.

CSC India

Version 1.0

Page 13 of 49

VSAM

VSAM Terminology

A"31R<A31 5<!1@ = Another view of data


0M1 L 10?1 10?10?@ %I0I 1 ;'M0 +$M06& ;a eN1 ;a eN;a eN@ ####### ####### ######## ;'M0 ;a eN1 ;a eN;a eN@ %I0I 0M1 L 10?1 10?10?@ +$M06& ##### ##### #####

95? ,=&D Alternate 5nde/ A Another View of !ataset

Alternate inde/ 'aths


Before accessing a 9&3& or 0&3& through an alternate index, a "ath using the 'M& 305I;0 1'$M co and# 't least one "ath ust !e defined# ' "ath is the eans !y which a !ase cluster is accessed !y way of its alternate indices# ' "ath is defined and na ed ust !e defined for each of the alternate o"ens a "ath for "rocessing, !oth the indices through which the !ase cluster is to !e accessed# $he "ath na e refers to the !ase cluster and alternate index "air# Ihen a "rogra !ase cluster and the alternate index are o"ened#

CSC India

Version 1.0

Page 14 of 49

VSAM

VSAM Dataset Types

.D VSAM !ata set 3%'es


Ie ha*e entioned that %&'M su""orts fi*e data set organizations8 entry-

sequenced, 7ey-sequenced, fixed-length and *aria!le-length relati*e record, and linear# In this section we will discuss each of these in detail#

1ntr% se2uenced data set (1S!S)


'n 0&3& is co "ara!le to a sequential non-%&'M data set in the sense that records are sequenced !y the order of their entry in the data set, rather than !y 7ey field in the logical record# $his could !e fixed or *aria!le length record# 'll new records are "laced at the end of the data set# 0xisting records can ne*er !e deleted# If the a""lication wants to delete a record, it a""lication "rogra ust flag that record as inacti*e# 's far as %&'M is concerned, the record is not deleted# It is the res"onsi!ility of the to identify that record as in*alid# 6ecords can !e u"dated, !ut ust either store it at without length change# $o change the length of a record, you length that you ha*e flagged as inacti*e# ' record can !e accessed sequentially or directly !y its 6B'8 O &equential "rocessing %&'M auto atically retrie*es records in stored sequence# &equential "rocessing can !e started fro in the "ositioning is necessary !efore sequential "rocessing can !e "erfor ed# O 3irect "rocessing Ihen a record is loaded or added, %&'M indicates its 6B'# $o retrie*e records directly, you ust su""ly the 6B' for the record as a search argu ent# 'lthough an 0&3& does not contain an index co "onent, you can !uild an alternate index to 7ee" trac7 of these 6B's# &7i" sequential "rocessing is not allowed for an 0&3&# 6efer to @#-, C9eyed sequenced data set (9&3&)D for ore infor ation on s7i" sequential "rocessing# the !eginning or so ewhere iddle of a data set, iddle of a data set# If "rocessing is to !egin in the

the end of the data set as a new record, or o*erride an existing record of the sa e

CSC India

Version 1.0

Page 15 of 49

VSAM

VSAM Data Set Types

5igure @-1 shows the for at of an 0&3&# 4I 1 6ecord 1 6B' 0 4I 6ecord A 6B' ?09J 4I @ 6ecord 9 6B' B1995? .=*D 1ntr% Se2uenced !ataset 0 "ty s"aces in the 4I are referred to as unused s"ace !ecause they can ne*er !e used# $his is a result of 4I internal frag entation (s"anned is only for logical records greater than the 4I)# <ou s"ecify 0&3& organization using the I34'M& 305I;0 co s"ecifying the ;+;I;30=03 "ara eter# and and 6ecord 10 2nused &"ace 635 635 635 4I35 6ecord J 6ecord 7 6ecord B 2nused &"ace 635 635 635 4I35 6ecord 6ecord @ 6ecord ? 2nused &"ace 635 635 4I35

-e%ed se2uenced data set (-S!S)


In a 9&3&, records are "laced in the data set in ascending collating sequence !y 7ey# $he 7ey contains a unique *alue that deter ines the recordHs collating "osition in the data set# $he 7ey ust !e in the sa e "osition in each record# $he 7ey data ust !e unique# 'fter it is s"ecified, the ust !e contiguous and each recordHs 7ey

*alue of the 7ey cannot !e altered, !ut the entire record can !e deleted# Ihen a new record is added to the data set, it is inserted in its collating sequence !y 7ey# $his could !e fixed or *aria!le length record# 6efer to 5igure --7 for the structure of a 9&3&# $here are three $hese are sequential, direct, or s7i"-sequential# O &equential access is used to load a 9&3&, and to retrie*e, u"date, add and delete records in an existing data set# %&'M uses the index to access data records in ascending or descending ethods !y which to access a 9&3&#

CSC India

Version 1.0

Page 16 of 49

VSAM

VSAM Data Set Types sequence !y 7ey# Ihen retrie*ing records, you do not need to s"ecify 7ey *alues !ecause %&'M auto atically o!tains the next logical record in sequence# $he sequence set is used to find the next logical 4I# &equential access allows you to a*oid searching the index accessing ore than once# &equential is faster than direct for ulti"le data records in ascending 7ey order#

CSC India

Version 1.0

Page 17 of 49

VSAM

VSAM Data Set Types

O 3irect access is used to retrie*e, u"date, add and delete records in an existing data set# <ou need to su""ly a 7ey *alue for each record to !e "rocessed# <ou can su""ly the full 7ey or a generic 7ey# $he generic 7ey is the high order "ortion of a full 7ey# 5or exa "le, you ight want to retrie*e all records whose 7eys !egin with the highest-le*el index set 4I to the =< (where =< is the generic 7ey), regardless of the full 7ey *alue# %&'M searches the index fro sequence set for a record to !e accessed# %ertical "ointers in the sequence set 4I are used to access the data 4' containing the record# 3irect access sa*es you a lot of o*erhead !y not retrie*ing the entire data set sequentially to "rocess a s all "ercentage of the total nu !er of records# &7i"-sequential access is used to retrie*e, u"date, add and delete records in an existing data set# %&'M retrie*es selected records, !ut in ascending sequence of 7ey *alues# &7i" sequential "rocessing allows you to - '*oid retrie*ing the entire data set sequentially in order to "rocess a relati*ely s all "ercentage of the total nu !er of records - '*oid retrie*ing the desired records directly, which causes the index to !e searched fro to" to !otto le*el for each record 5or each request the sequence set is used to find the next logical 4I and to chec7 if it contains the requested record# If the first s7i"-sequential search is the first access after o"ening the data set, a direct search is initiated !y %&'M to find the first record# 5ro then on the index sequence set le*el will !e used to find the su!sequent records# If other o"erations were "erfor ed !efore (for exa "le, read sequential), either the last "osition of that o"eration will !e used as a starting "oint to search the sequence set records, or a re-"ositioning is necessary# <ou s"ecify the 9&3& organization using the I34'M& 305I;0 co I;30=03 "ara eter# and with the

Relative record data set (RR!S)


'n 663& consists of a nu !er of "re-for atted fixed-length slots# 0ach slot has a unique relati*e record nu !er, and the slots are sequenced !y ascending relati*e record nu !er# 0ach fixed length logical record occu"ies a slot, and is stored and retrie*ed !y the relati*e record nu !er of that slot# $he "osition of a data record is fixed and its relati*e record nu !er cannot change# Because the slot can either contain data or !e e "ty, a data record can !e inserted or deleted without affecting the "osition of other data records in the 663&# $he CSC India Version 1.0 Page 18 of 49

VSAM

VSAM Data Set Types 635 shows whether the slot is occu"ied or e "ty# 5ree s"ace is not "ro*ided !ecause the entire data set is di*ided into fixed-length slots#

CSC India

Version 1.0

Page 19 of 49

VSAM

VSAM Data Set Types

Fig"re '$2 s(o)s t(e for*at of an RRDS& 4I 0

C O N T R O L

SLOT 1

SLOT 2

SLOT 3

RDF

RDF

CIDF

A R E A

4I 1 SLOT 4 SLOT 5 SLOT 6 RDF RDF CIDF

95? .=,D Relative record data set (RR!S)

3%'ical RR!S 'rocessing


$he a""lication "rogra in"uts the relati*e record nu !er of the target record and %&'M is a!le to find its location quic7ly using a for ula that ta7es into consideration the geo etry of the 3'&3 de*ice# $he relati*e record nu !er is always used as a search argu ent# 'n 663& can !e sequentially# O 663& sequential "rocessing is treated the sa e way as 0&3& sequential "rocessing# 0 "ty slots are auto atically s7i""ed !y %&'M# O 'n 663& can !e "rocessed directly !y su""lying the relati*e record nu !er as a 7ey# %&'M calculates the 6B' and accesses the a""ro"riate record or slot# 663& direct address "rocessing !y su""lying the 6B' is not su""orted# O &7i"-sequential "rocessing is treated li7e an 663& direct "rocessing request, !ut the "osition is aintained# 6ecords ust !e in ascending sequence# and <ou s"ecify the 663& organization using the I34'M& 305I;0 co with the ;2MB0603 o"tion# "rocessed sequentially, directly or s7i"-

CSC India

Version 1.0

Page 20 of 49

VSAM

VSAM Data Set Types

Varia)le relative record data set (VRR!S)


' %663& is si ilar to a fixed-length 663&, exce"t that it contains *aria!le-length records# 0ach record has a unique relati*e record nu !er, and is "laced in ascending relati*e record nu !er order# 0ach record is stored and retrie*ed using its relati*e record nu !er# %663& has no slots# $he relati*e record nu !er of a record cannot change# Ihen that record is erased, the relati*e record nu !er can !e reused for a new record# <ou can s"ecify free s"ace for inserting records and increasing the length of a record# %663& is a 9&3& "rocessed as an 663&, so an index will !e created# <ou s"ecify the %663& organization with the I34'M& 305I;0 co *aria!le length record# and with the ;2MB0603 o"tion and

"inear data set ("!S)


' linear data set (:3&) contains data that can !e accessed as !yte-addressa!le strings in *irtual storage# It is a %&'M data set with a control inter*al size of ?09J !ytes# 'n :3& has no i !edded control infor ation in its 4I that is, no 635s and 4I35s# 'll :3& !ytes are data !ytes# :ogical records ust !e !loc7ed and the "oint of de!loc7ed !y the a""lication "rogra , !ut records do not exist fro

*iew of %&'M# :i7e the 0&3& and 663&, an :3& contains a data co "onent only# 'n :3& can only !e defined using I45 catalogs# I34'M& is used to define an :3& !ut it is accessed using a 3ata-In-%irtual (3I%) referred to as a 3I% o!.ect# 5igure @-@ shows the for at of an :3&# acro# 'n :3& is so eti es

4I

C O N T R O L

DATA

A R E A

4I DATA

95? .=.D "inear !ata Set ( "!S )

CSC India

Version 1.0

Page 21 of 49

VSAM

VSAM Data Set Types <ou s"ecify the :3& organization with the I34'M& 305I;0 co the :I;0'6 "ara eter# and s"ecifying

CSC India

Version 1.0

Page 22 of 49

VSAM

VSAM Data Set Types

Com'aring VSAM data set organi4ations


$a!le @-1 "ro*ides a su descri!ed in this cha"ter# ary of the characteristics of %&'M data set ty"es

Table '$1 Com'arison

of 1S!SE -S!SE RR!SE VRR!SE and linear data sets


Fixed-Length RRDS Records are in relative record number order Records have fixed length Direct access by relative record number Consist of data component only No alternate index Allowed A records relative record number cannot change Empty slots is in the data set are used for adding records A slot given up by a deleted record can be reused VariableLength RRDS Records are in relative record number order Records have variable length Direct access by relative record number Consist of data and index components No alternate index Allowed A records relative record number cannot change Free space is used for inserting and lengthening records Space given up by a deleted or shortened record becomes free space No spanned records Extended format allowed Linear Data Sets No processing at record level

ESDS

KSDS

Records are in the same order as they are entered Records can be fixed or variable length Direct access by RBA Consist of data component only Alternate index Allowed A records RBA cannot change Space at the end of the data set is used for adding records A record cannot be deleted, but you can reuse its space for a record of the same length Spanned records Allowed Extended format allowed

Records are in Collating sequence by key field Records can be fixed or variable length Direct access by key or by RBA Consist of data and index components Alternate indexes Allowed A records RBA can change Free space is used for inserting and lengthening records Space given up by a deleted or shortened record becomes free space Spanned records Allowed Extended format or compression

No processing at record level Access with Data-In-Virtual (DIV) Consist of data component only No alternate index Allowed No processing at record level No processing at record level

No processing at record level

No spanned records Extended format alowed

No spanned records Extended format allowed

CSC India

Version 1.0

Page 23 of 49

VSAM

VSAM Data Set Types

Choosing a VSAM data set t%'e


3uring the a""lication de*elo" ent "rocess you need to data odel# ' ong the a7e decisions a!out your

are the data organization and the ty"e of access,

"erfor ance, and reco*ery tools you need# %&'M has se*eral organizations and different ways for accessing your data# Mow to choose the one for your a""lication is discussed here# $he a.or issues are functionality, "erfor ance, and reco*ery ca"a!ilities# Before

you select a "articular %&'M organization, you need to ha*e answers for the following questions8 O Ihat is the ain "ur"ose of your data setP 3oes it loo7 ore li7e a log, a odeP data!ase, or an in*entoryP O 3o you need to access data !y a 7ey field in sequential or direct of the P O 're all the logical records the sa e lengthP O 3oes the record length changeP O 3o you need to ha*e insertions and deletionsP O Is the data set going to !e extendedP O Mow often will you need to delete recordsP O Iill you use s"anned recordsP O 3o you want to 7ee" the data in order !y the contents of the 7ey fieldP O 3o you want to access the data !y an alternate indexP O 3o you need the utility functions "ro*ided !y I34'M&P Ihen you ha*e answered these questions, we can use the to choose the !est O 3o you need to access the records in sequence, s7i" sequential, rando ly, or all

organization for your data set# 6e e !er that %&'M data sets cannot !e "rocessed using non-%&'M a""lications# &i ilarly, non-%&'M data sets cannot !e "rocessed using the %&'M access ethod#%&'M dataset choice

9&3& :ess 3'&3 +n-line 3irect 'ccess Batch &equential 'lternate Index &tatic data 0ase of "rogra ing and CSC India

0&3&

663&

Version 1.0

Page 24 of 49

VSAM aintenance

VSAM Data Set Types

95? .=0D VSAM !ataset Choice

CSC India

Version 1.0

Page 25 of 49

VSAM

VSAM Data Set Types

5ollowing are our reco O 2se Q&'M or B&'M if8

endations#

- <ou use no direct "rocessing# - $here are no insertions or deletions, and no change in the logical record length# - 6ecord additions are only at the end of the data set# - <ou are not concerned a!out I34'M& functions# - <ou want to ha*e data co "ression# - 1erfor ance and easy reco*ery are O 2se 9&3& if8 - $he data access will !e sequential, s7i" sequential, and direct access !y a 7ey field# - <ou would "refer easy "rogra - $here will !e *ariations# - <ou ay o"tionally access records !y an alternate index# - 4o "lex reco*ery (due to index and data co "onents) is not a issue# - <ou want to use data co "ression# - $he data is suita!le for a sort of en*iron ent li7e O 2se 663& if8 - $he record "rocessing will !e sequential, s7i" sequential, or direct "rocessing# - 0asy "rogra ing for direct "rocessing is not a require ent# ode is a relati*e record - $he argu ent for accessing data in direct ini-data!ase in an online a""lication 4I4&,%&'M# ing for direct data "rocessing# any record insertions, deletions, and logical record length ain issues#

nu !er, not the contents of a data field (7ey)# 663& is suita!le for the ty"e of records identified !y a continuous and dense "attern of nu !ers# - 'll records are fixed length# - $here are a s all nu !er of record insertions and deletions, and all the s"ace for insertions ust !e "re-allocated in ad*ance# - 1erfor ance is an issue# 663& "erfor ance is !etter than 9&3&, !ut worse than Q&'M or B&'M#

CSC India

Version 1.0

Page 26 of 49

VSAM

VSAM Data Set Types

O 2se 0&3& if8 - <ou need sequential and direct record "rocessing (not !y a 7ey field, !ut !y an 6B')# - <ou are using only logical record insertions or deletions (in the a""lication control)# - <ou are using a !atch "rocessing a""lication# O 2se :3& if8 - <ou want to ex"loit 3I%# - <our a""lication anages logical records# - 1erfor ance is an issue# ' final co ent is that any ti es, you will !e using a s"ecific %&'M organization

de"ending on the software "roduct you are running for exa "le, 3B- uses :3& data sets# In such a case, this will !e your only o"tion

CSC India

Version 1.0

Page 27 of 49

VSAM

Accessing VSAM data

0D Accessing VSAM data


%&'M data sets can !e accessed using se*eral ethods, for exa "le, I34'M&, 3I$$+, !atch and 4I4& a""lication "rogra s, and 3B-# Batch and 4I4& a""lication "rogra s can !e written using languages that su""ort %&'M, such as 4+B+: and 'sse !ler# $o o!tain %&'M ser*ices, these a""lication "rogra s use %&'M acros#

5!CAMS
'ccess ethod ser*ices ('M&) is a ser*ice "rogra used with %&'M to esta!lish and fro aintain catalogs and and its within another

and data sets in*o7ed !y F4: or $&+# $he I34'M& "rogra "rogra and "ass the 'M& co and and "ara eters to the

can !e run with the 'M& co

"ara eters as in"ut to the I34'M& "rogra # <ou can call the I34'M& "rogra

I34'M& "rogra # Ie can create and "rocess the *arious ty"es of %&'M data sets using I34'M&, which is included with 35&M&,M%&# $here are two ty"es of 'M& co co ands for catalogs and user data sets, functional co ands# 5unctional co ands and odal

ands# &ee 5I/ ?-1 for list of 'M& 4o

ands are used to request the actual ands allow the conditional ands only#

wor7 (for exa "le, defining a data set or listing a catalog)# Modal co execution of functional co

ands# $i e sharing o"tion ($&+) users can use functional co

Access Method Services (AMS)

6 0 ' $ 0 + B F 0 4

% & $ &

'

: I & $ 4 I n f o r

a t a lo g a t io n D E F IN E L IS T C A T E - P +

: o a d in g

n lo a d in g

R T .I,

P +

R T

o d if y 3 a t a s e t ' t t r i! u t e s

A L T E R

ID C A ,

R E P R +

o " y in g

D E L E T E

P R IN T

e le t e % & + ! .e c t s

'

: is t

a t a s e t s

95? 0=*D AMS Commands CSC India Version 1.0 Page 28 of 49

VSAM

Accessing VSAM data

I34'M& can !e in*o7ed8 O 's a .o! or .o!ste" !y s"ecifying 1/MRI34'M& on the 0=04 card O 5ro O 5ro a $&+ ter inal an a""lication "rogra

!533671SA
3I$$+ is *ery "owerful utilities that you can use to !rowse, edit, and delete %&'M records# <ou can start 3I$$+ in full-screen ode fro a $&+ ter inal# 4hec7 with your syste "rogra er how to in*o7e enus, online ode the ost 3I$$+ as start "rocedures ay *ary with the installation# In full-screen ode, you can use

hel", and interacti*e !rowse and u"date functions# <ou will "ro!a!ly find full-screen co and, or !atch odes#

con*enient way to run 3I$$+, es"ecially if you are a new 3I$$+ user# <ou can also run 3I$$+ in line,

!efining VSAM data sets


<ou can define a %&'M data set using any of the following / IDCA,S 305I;0 or '::+4'$0 co O ALL+CATE co**and fro ands# ethods8

a $&+ ter inal#

O 0CL DD state*ents# 'll data sets can !e defined directly through F4:#

8sing 5!CAMS
Ihen using I34'M& to define a %&'M data set, you s"ecify the following8 O 3ata set na e or cluster na e# 4o "onent na es are o"tional# O 3ata set ty"e# $he default is I;30=03 (9&3&)# I;30=03 9&3& :I;0'6 :3& ;+;I;30=03 0&3& ;2MB0603 663& O &"ace allocation, !oth "ri ary and secondary allocations, and the *olu es on which the clusterGs co "onents are to ha*e s"ace# O 3ata set attri!utes, such as recordsize and 4I size# 5or a 9&3&, you s"ecify 7ey infor ation and free s"ace#

CSC India

Version 1.0

Page 29 of 49

VSAM 'n exa "le for the 3efine co DEFINE CLUSTER $1 NA,E 1entr2na*e33$C4LINDERS 15ri*ar2 secondar236 7 IL+ 84TES 15ri*ar2 secondar236 ,E# A84TES 15ri*ar2 secondar236 REC+ RDS 15ri*ar2 secondar236 TRAC7S 15ri*ar2 secondar23 9 V+LU,ES 1 oles : oles&&&;3 $DATA 15ara*eters3 $INDE15ara*eters3 $CATAL+#1 s"b5ara*eters3 and is gi*en !elow#

Accessing VSAM data

CA si4e
$he 4' size for the data co "onent is deter ined !y the s aller *alue s"ecified for "ri ary and secondary allocation in the 305I;0 co and# Mowe*er, 4' size cannot !e greater than one cylinder# ega!ytes, records, and trac7s# ' 7ilo!yte or O &"ace allocations can !e s"ecified in cylinders, 7ilo!ytes, the results when allocating a %&'M data set8 O If *alue S 1 cylinder, 4' size equals trac7 allocation# O If *alue T 1 cylinder, 4' size equals one cylinder# $he 4' size for index co "onent is set to one 3'&3 trac7#

ega!yte will resol*e to either trac7s or cylinders# ' record allocation resol*es to trac7s# $he following are

9ree s'ace o'tions


5ree s"ace is the reser*ed s"ace to !e held free when the cluster is initially loaded or when a 5600&1'40 "ara eter a""lies only to the data co "onent of 9&3&# <ou can s"ecify the a ount of 4I and 4' free s"ace when you define the data set using the I34'M& 305I;0 co and# <ou can change the a ount of free s"ace using the I34'M& ':$06 co and# 5ree s"ace is s"ecified as a "ercentage# 5or a 4I, %&'M ta7es the s"ecified "ercentage ti es the actual 4I size rounded down to a full !yte# %&'M does not care a!out the record length# $he 4' "ercentage s"ecifies the a ount of 4Is to !e held "er 4'# $he nu !er of e "ty 4Is "er 4' is the nu !er of 4Is "er 4' ti es the 4' "ercentage# $he trac7 required for the sequence set is not included in the calculation of 4Is "er 4', and the calculated figure is rounded down to the next integer# If the figure is less than one, it is the sa e as s"ecifying 100U ass insert is done# $he "ur"ose is to allow data records to !e inserted or ex"anded in length when u"dated# $he

CSC India

Version 1.0

Page 30 of 49

VSAM for the 4' "ercent *alue# If you s"ecify 100 (the axi u

Accessing VSAM data *alue) for !oth the 4I and 4' "ercentage, each

control inter*al will contain one record and each control area will contain one used control inter*al# If the 5600&1'40 a ount is altered after the data set is initially loaded, and sequential insert "rocessing is used, the allocation of free s"ace is not honored# $he syntax of the 5600&1'40 "ara eter is FREESPACE 1CI$5ercent CA$5ercent3 <e reco**end t(at 2o" s5ecif2= FREESPACE 12> 2>3 &"ecify 4' free s"ace to a*oid 4' s"lits# 4I s"lits are not as ti e-consu ing as 4' s"lits# $he &M'60+1$I+;& "ara eter s"ecifies how the co "onent or cluster can !e shared a ong users within one syste o"tionsV for or across syste s# 6efer to ?#-#?, C4ross-region o"tionsD and ?#-#A, C4ross-syste ust not !e shared with nonore details#

&M&- anaged *olu es and catalogs containing &M&- anaged data sets &M& syste s# $he syntax for the &M'60+1$I+;& "ara eter is S?ARE+PTI+NS 1crossregion crosss2ste*3

5M:1! and R1$"5CA31


$he IMB03 "ara eter requires that the sequence set is written as as it can fit in a trac7# $he syntaxes of I34'M& co ands are discussed in detail in the next section# any ti es as it can fit in the first trac7 any ti es

of each data 4'# Iith the 601:I4'$0 "ara eter, each index record at all le*els is written as

CSC India

Version 1.0

Page 31 of 49

VSAM

Access Method Services [AMS] -IDCAMS

5D Access Method Services FAMSG = 5!CAMS


;C" for 5!CAMS
I34'M& utility is nor ally executed in !atch following generic structure ..STEP>1> E-EC P#,=IDCA,S ..S4SPRINT DD S4S+UT=@ ..S4SIN DD@ AIDCA,S co**and fro* col&2 to col&%2B .@ ..@ ode !y calling it using a F4:# $he F4: always has the

:asic 5!CAMS Commands


$here are any co ands that hel" us wor7 with %&'M datasets using the utility I34'M&# Ie will ands that are used often# $hese co ands are listed !elow#

discuss here the co

DEFINE 1Cl"sterC Alternate IndeD etc&3 8UILDINDE- 1Alternate IndeD3 REPR+ 1Cl"ster3 LISTCAT 1Catalog Entries3 I,P+RT . E-P+RT 1Cl"ster3 %06I5< (4luster)

!195<1 Command
$he !asic syntax for the 305I;0 co DEFINE CLUSTER 1NA,E 1-IND&NLT&CLUSTER3 C4LINDERS 1E 13 F+LU,ES 1<+R>13 AData set t25eB 3 $ $ $ $ and is as !elow# $

$he K-H is the continuation character and are nor ally aligned# ;'M0 is a "ositional 7eyword "ara eter and ust !e coded first# +ther 7eywords can !e "laced anywhere# KWG sign is used for continuation within a field 5or exa "le8 DEFINE CLUSTER 1NA,E 1-IND& G NLT&CLUSTER33 $

CSC India

Version 1.0

Page 32 of 49

VSAM $he other "ara eters of the 305I;0 co

Access Method Services [AMS] -IDCAMS and are discussed !elow# Record siHe 5ara*eter

S2ntaD= REC+RDSIIE 1A erage ,aDi*"*3 $his "ara eter is +"tional T(e defa"lt al"e for t(is 5ara*eter if not coded eD5licitl2 is= $he '*erage X Maxi u *alues are sa e for 5ixed length records $ $ $ $ $ J>KL

DEFINE CLUSTER 1NA,E 1-IND&NLT&CLUSTER3 C4LINDERS 1E 13 F+LU,ES 1<+R7>13 REC+RDSIIE 112> 12J3 INDE-ED)

7E4S Para*eter S4NTA- = 7E4S 1lengt( offset3 $his used for 9&3& only # It is an o"tional "ara eter and if not coded the default *alue is 8 :engthRJ? X +ffsetR0 DEFINE CLUSTER 1NA,E 1-IND&NLT&CLUSTER3 C4LINDER 1E 13 F+LU,ES 1<+R7>13 REC+RDSIIE 112> 12J3 7E4S 1K >3 INDE-ED3 $ $ $ $ $ $ Dataset t25e 5ara*eters $he following are the dataset "ara eters to !e coded in the I34'M& F4: for the *arious ty"es of %&'M datasets# 7SDS ESDS RRDS LDS = = = = INDE-ED or I-D N+NINDE-ED or NI-D NU,8ERED LINEAR

CSC India

Version 1.0

Page 33 of 49

VSAM

Access Method Services [AMS] -IDCAMS Data M indeD co*5onents

$hese co "onent na es are required when the installation default na es are required to !e o*erridden# DEFINE CLUSTER 1NA,E 1-IND&NLT&CLUSTER3 C4LINDER 1E 13 F+LU,ES 1<+R7>13 REC+RDSIIE 112> 12J3 7E4S 1K >3 INDE-ED3 DATA 1NA,E 1-IND&NLT&CLUSTER&DATA33 INDE- 1NA,E 1-IND&NLT&CLUSTER&INDE-33 $ $ $ $ $ $

A,S 5erfor*ance 5ara*eters $he next i "ortant "ara eter required during creation of a %&'M file is the 4+;$6+: I;$06%': &IE0# S2ntaD = 4+;$6+:I;$06%':&IE0 (!ytes) Abbr = 4I&E or 4I&IE0 $he default *alue for 4ontrol Inter*al size if not s"ecified is calculated !y %&'M# $he *alue of the 4ontrol Inter*al &ize (4I35 and 635) and 5600&1'40 "ro*iding 4I&IE0 is as !elow8 If the record length is SB19-, ulti"les of A1-, TRB19-, ulti"les of -0?B FREESPACE ust !e ta7en into consideration# # $he $hu ! 6ule for

$he &yntax to "ro*ide the 5600&1'40 "ara eter is as !elow8 FREESPACE 1CIN CAN3 $he default *alue for the 5600&1'40 "ara eter is as !elow8 FREESPACE 1> >3 ore I,+ and consu es larger 3'&3 s"ace#

' *ery high *alue for 5600&1'40 results in 5600&1'40 de"ends on8 6ate of growth of records 0x"ected nu !er of records to !e deleted 6eorganization frequency 1erfor ance consideration

' *ery low 5600&1'40 result in increase in 4I s"lits and degrades "erfor ance# $he a ount of

CSC India

Version 1.0

Page 34 of 49

VSAM

Access Method Services [AMS] -IDCAMS 8UFFERSPACE

$he &yntax to "ro*ide the B25506&1'40 "ara eter is as !elow8 8UFFERSPACE 1b2tes3 $he a!!re*iation for coding the "ara eter is8 8UFSP 1b2tes3 $he default *alue for the B25506&1'40 "ara eter is8 $wo data !uffers "lus one additional index !uffer for 9&3& $his "ara eter is used to i "ro*e In"ut,out"ut "erfor ance $his "ara eter can also !e s"ecified in the F4: as !elow8 ..DD1 DD DSNA,E=AN4FSA,1C ..A,P=1O8UFND=JC8UFNI=JCSTRN+=2O3 $he "ara eters in the a!o*e F4: are ex"lained in the following su!-section#

R1C6V1R> 7 S$11!
$he two "ara eters are utually exclusi*e# 604+%06< allows you to reco*er if the .o! initially loading the dataset fails# &1003 is faster !ut does not "ro*ide restart feature# 3efault is 604+%06<

S$A<<1!
$he &yntax for this "ara eter is SPANNED.N+NSPANNED 3efault *alue is ;+;&1';;03 $his "ara eter allows large records to s"an ore than one 4ontrol

Inter*al Mowe*er, the records cannot s"an across 4ontrol areas 663& does not su""ort s"anned records#

-1>RA<?1S
$he syntax for this "ara eter is 7E4RAN#ES 1Lo) $ FalP ?ig( $ Fal3 $he default *alue is ;one (;o range assu ed)# 5or 0xa "le, 90<6';/0& ((000001 100001 -00000)) 100000)W

$he 9ey 6anges corres"ond to %+:2M0& if +630603 clause is s"ecified#

CSC India

Version 1.0

Page 35 of 49

VSAM

Access Method Services [AMS] -IDCAMS

6R!1R1!
$he syntax for this "ara eter is +630603 , 2;+630603 $he default *alue is 2;+630603# $his "ara eter goes together with 90<6';/0& clause s"ecifies the *olu e to which the 7ey *alues should go#

R18S1
$he syntax for this "ara eter is

REUSE/NOREUSE $he default *alue is ;+602&0# 602&0 s"ecifies that the cluster can !e loaded with fresh records with an i "licit delete of existing records# 602&0 cannot !e used under following circu stances and hence not reco ended

Ihen 90<6';/0& "ara eter is coded Ihen alternate indexed are defined

REPLICATE
$his "ara eter directs the %&'M to du"licate each index as any ti es as it will fit on its assigned trac7# a7e I,+ faster $his a""lies only to 9&3& index co "onent# $his hel"s to reduce rotational delay and to $he &yntax to code this "ara eter is 8 6e"licate , ;ore"licate $he 3efault *alue for this "ara eter is8 ;+601:I4'$0

V6"8M1S
$his "ara eter is used to s"ecify different *olu es for the 3ata 4o "onent and Index 4o "onent

CSC India

Version 1.0

Page 36 of 49

VSAM

Access Method Services [AMS] -IDCAMS

5M:1!
$his "ara eter directs the %&'M to "lace the sequence set (the lowest le*el of index next to the data co "onent) on the first trac7 of the data control area and du"licate it as $he default *alue is ;+ I,8ED $he syntax to code the "ara eter is I,8ED . N+ I,8ED S(are o5tion $he syntax to code this "ara eter is S?ARE+PTI+NS 1Cross$region$ al"e Cross$s2ste*$ al3 ex8 $&+X4I4& any ti es as it will fit# $his "rocess will reduce rotational delay !ecause the desired sequence set record is found faster

$he 4ross$region o"tion hel"s in concurrent data access on a stand-alone syste accessing sa e data) $he Cross$s2ste* hel"s in data access for connected) $he default is8 S?ARE+PTI+NS 11 '3 $he *alues of the *arious "ossi!le *alues for the a!o*e are 1& 2& '& J&

ulti"le co "uters ($wo different co "uters that are inter-

entioned !elow with their

eanings

,"lti5le Qobs can read onl2 if no "5date taRes 5lace $ Co*5lete data integrit2 ,"lti5le Qobs can read and at t(e sa*e ti*e one Qob can "5date $ <riteC b"t not read integrit2 ,"lti5le Qobs can read M )rite si*"ltaneo"sl2 $ No integrit2 Sa*e as o5tion 'C b"t refres(es b"ffer after e er2 read

$he &hare o"tions 1 X - are not allowed for cross-syste # 5or cross-region sharing, each !atch .o! ha*e 3I&1R&M6# 5or cross syste sharing 3I&1 "ara eter in the F4: is i aterial#

ust

CSC India

Version 1.0

Page 37 of 49

VSAM

Access Method Services [AMS] -IDCAMS

1RAS1 7 <61RAS1
$he default *alue for this "ara eter is N+ERASE $he *alue ERASE instructs %&'M to o*e zeroes to all the !ytes once the cluster is deleted

M6R1 AMS C6MMA<!S R1$R6


$his is an all-"ur"ose load and !ac7u" utility co file with another %&'M file or sequential file# It is against all four ty"es of %&'M datasets# $he !asic &yntax is8 REPR+ INDATASET 1DSN3 or INFILE 1DD13 +UTDATASET 1DSN3 or +UTFILE1DD23 S7IP 1co"nt3 C+UNT1co"nt3 FR+,7E4 FR+,ADDRESS FR+,NU,8ER T+7E4 T+ADDRESS T+NU,8ER REUSE.REPLACE $he INFILE or INDATASET "ara eter is andatory, si ilarly +UTFILE or +UTDATASET is andatory# and# $his can !e used against e "ty , loaded %&'M uch easier to use than I0B/0;06# It can !e used

'll other "ara eters are o"tional# S7IP s"ecifies nu !er of in"ut records to s7i" !efore !eginning to co"y# C+UNT s"ecifies nu !er of out"ut records to co"y# REUSE "ara eter can !e used only if the %&'M dataset was originally defined with 602&0 o"tion# $his has the effect of logically deleting records !efore loading# $he REPLACE "ara eter re"laces the records for which "ri ary 7eys are out"ut records# If not s"ecified, the are a""ended and 601:'40 is ina""ro"riate# atching !etween in"ut and atching 7ey records are untouched# If the target is 0&3& the records

CSC India

Version 1.0

Page 38 of 49

VSAM Re5ro $ EDa*5le .. REPR+ E-EC P#,=IDCA,S .. S4SPRINT DD S4S+UT=@ .. DD2 DD DSN=-IND&NLT&CLUSTER&8AC7UP 1G13 .. DISP=1NE<CCATL#CCATL#3C UNIT=TAPE .. F+L=1SER=12121'C LA8EL=11CSL3C .. DC8=1RECF,=F8C LRECL=K>3 ..DD1 DD DSN=-IND&NLT&CLUSTERC DISP=S?R .. S4SIN DD@ REPR+ INFILE 1DD13 +UTFILE 1DD23 REUSE .@

Access Method Services [AMS] -IDCAMS

1@$6R375M$6R3
$his is used for !ac7u" and reco*ery# $he 4atalog infor ation also is ex"orted along with the data, unli7e 6016+# $he 35&M& classes are "reser*ed# $he 4luster deletion and redefinition are not necessary during the i "ort# It can !e easily "orted to other syste s# $he disad*antages are that the 0=1+6$03 file not reusa!le until it is i "orted and it is slower than 6016+

V1R59>
This parameter is used to verify the physical existence of a VSAM file and close the file if it is not previously closed successfully. $he syntax for this is %06I5< 5I:0 (Sddna eT) +R %06I5< 3'$'&0$ (Sdatasetna eT) $his can !e issued fro $&+ or fro a F4:# $his *erifies the catalog M26B' (Migh 2sed 6elati*e Byte the control !loc7 M26B' field#

'ddress) field and stores the true *alues fro

It should !e used against cluster na e only and not against data or index co "onents# $his is used to rectify so e of the "ro!le s due to data corru"tion#

CSC India

Version 1.0

Page 39 of 49

VSAM

Access Method Services [AMS] -IDCAMS

"5S3CA3
$his is used to list the contents of a LISTCAT aster or user catalog# $he syntax is

CATAL+# 1na*e3 ENTRIES 1na*e $ of $ entries3 LEFEL 1generic$le e$na*es3

$he other "ara eters that can !e "ro*ided are8 ALL ?IST+R4 ALL+CATI+N CREATI+N 1da2s3 +UTFILE 1dd na*e3 NA,E F+LU,E N+T USA8LE E-PIRATI+N

ALTER $his is used to change "ara eters such as 5600&1'40# $his as no effect on existing 4I X 4' s"lits# $he syntax is ALTER entr2$na*e

!1"131
$he syntax is DELETE AobQect na*eB 15ara*eters3 EDa*5le= DELETE -IND&NLT&CLUSTER 'll the "ara eters are o"tional# 3eletes all su!ordinate o!.ects such as 'I=, 1ath So*e Co**on DELETE Para*eters 06'&0 , ;+ 06'&08 06'&0 writes !inary zeroes after deletion 126/0 , ;+ 126/08 126/0 allows deletion e*en though ex"iration date is still due ':$06;'$0 I;30= +r 'I=8 3eletes only 'lternate index of the cluster 1'$M8 6equests only "ath na e to !e deleted# 5+640 , ;+ 5+6408 5+640 deletes the dataset e*en if it is not e "ty

CSC India

Version 1.0

Page 40 of 49

VSAM Alternate IndeDes

Access Method Services [AMS] -IDCAMS

Ie will now discuss the "ara eters in*ol*ed in creating the 'lternate Indexes# ':$06;'$0 I;30=0& $hese are used whene*er the data is required to !e retrie*ed on the !asis of fields other than "ri ary 7ey field# e&g&C 0 "#no 010 011 0101@ &alary 10000 1A000 1-000 B000 95? 5=*D Alternate 5nde/es 3e"t $6/ &211 &I &211

In the a!o*e, the 0 "loyee nu !er can !e the "ri ary 7ey and the 3e"art ent could !e the 'lternate 7ey# 'lternate Index can !e defined for !oth 9&3& X 0&3&# It will reduce data redundancy# It can ha*e du"licates# It is easy to define using I34'M&# $his allows datasets to !e accessed sequentially or rando ly# $his can !e u"dated auto atically

A5@ A !isadvantages
2se of 'lternate Index leads to "erfor ance degradation# 'lternate Index in*ol*es co "lex u"date logic# Alternate indeD organiHation 'lternate Indexes are 9&3& !y the sel*es and ha*e their own data and index co "onents# $he 'I= data co "onents contain the alternate index 7ey *alues and "ointers to each record containing the 7ey *alue# $he 'I= index co "onents contain highest 7ey *alue in an 'I= data 4I and a "ointer to that 4I# $he 'I= data co "onent has *aria!le length records if du"licate is allowed (due to ulti"le "ointers)

CSC India

Version 1.0

Page 41 of 49

VSAM

Access Method Services [AMS] -IDCAMS

9ey

1tr

9ey 1tr

'I= Index 4o "onent

?d r

7e2

Ptr1

Ptr2

Ptr'

?d r

7e2

PtrJ

FSP C

U S

CF

?d r

7e2

PtrE

?dr

7e2

PtrL

Ptr%

FSP C

U S

CF

AIX data CIs

1tr1 to 1tr7 "oint to the data co "onent of the !ase cluster 95? 5=,D Alternate 5nde/ 6rganisation Ste5s for Creating Alternate IndeD $he following are the ste"s to create an 'lternate Index# Define AI- "sing IDCA,S DEFINE AIS5ecif2 Alternate IndeD Pat( "sing IDCA,S DEFINE PAT? 8"ild AI- M 5o5"late it "sing IDCA,S 8LDINDEEDa*5le= 3efine 'I= (;'M0 (=I;3#;:$#%&'M 301$# 'I=) %+:2M0& (I+6901) 60:'$0 (=I;3#;:$#%&'M) 21/6'30 4<:I;306& (A, 1) 90<& (B 10) 604+63&IE0 (1-? 1-?) 5600 &1'40 (-0 10) &M'60 +1$I+;& (1 @) ;+; 2;IQ2090<) I;30= (;'M0 (=I;3#;:$#%&'M#301$#'I=#I;30=)) 3'$' (;'M0 (=I;3#;:$#%&'M#301$#'I=#I;30=)) -

CSC India

Version 1.0

Page 42 of 49

VSAM

Access Method Services [AMS] -IDCAMS

$he syntax to define the 'lternate Index is ex"lained in detail !elow8 DEFINE ALTERNATE INDEOR DEFINE AI- RESUIRE,ENT PARA,ETER Na*e $he syntax to code the na e is NA,E $his is a required "ara eter and it is ad*isa!le that na e con*eys 'I= "ur"ose Fol"*es $he syntax is Fol"*es 1Fol$ser$1 &&&&& ol$ser$n3

$his is also a required "ara eter and assigning !ase cluster X 'I= in different *olu es i "ro*es "erfor ance RELATE $he syntax is RELATE 1base cl"ster na*e3 $his is a required "ara eter and it esta!lishes relationshi" !etween the !ase cluster X 'I= UP#RADE.N+UP#RADE $he syntax is UP#RADE.N+UP#RADE $he o"tion UP#RADE s"ecifies that records in 'I= are to !e u"dated auto atically whene*er the !ase cluster is u"dated $he default *alue is UP#RADE

-1>S
$he syntax is 7E4S 1lengt( offset3 $his "ara eter is +"tional# $he "ri ary 7ey *alues are ta7en as default, if not s"ecified# $his defeats the "ur"ose of 'lternate Index, if not s"ecified

CSC India

Version 1.0

Page 43 of 49

VSAM

Access Method Services [AMS] -IDCAMS

R1C6R! S5B1
$he syntax is REC+RD SIIE 1a erage *aDi*"*3 $he default *alue is REC+RDSIIE 1J>KL '2L>>3& $he a!!re*iation is RECSI& $he '*erage X sa e for 2;IQ2090< 'I= and using the following thu ! rule# 'I= for a 9&3& 604&E R A W 'I=9: W (n x B49:) 'I= for 0&3& 604&E R A W 'I=9: W (n x ?) Ihere8 'I=9: is the alternate-7ey length B49: is the !ase clusterHs "ri e-7ey length n R 1 when 2;IQ2090< is s"ecified n R the nu !er of data records in the !ase cluster that contain the sa e alternate-7ey *alue, when ;+;2;IQ2090< is s"ecified# ax# are

ay !e different for ;+;2;IQ2090<# $he record size can !e calculated

6ther A5@ 'arameters


$he following is the list of other "ara eters that can !e coded while defining the are listed !elow# '$$0M1$& '2$M (entry "oint) B25506&1'40 (!ytes) 4'$':+/ (catalog,"w) 4+30 (code) 4I&E (!ytes) 4+;$6+:1I ("assword) 06'&0 (;+06'&0) 0=401$I+;0=I$ (entry "oint) 90<6';/0& (low-7ey high 7ey) M'&$061I ("assword) +630603,2;+630603 60'31I ("assword) 601:I4'$0,;+601:I4'$0 602&0,;+602&0 &M'601Y$+1M& &1003,604+%06< 2;IQ2090<,;+;2;IQ2090< 213'$01I ("assword) I6I$04M049,;+I6I$04M049

CSC India

Version 1.0

Page 44 of 49

VSAM

Access Method Services [AMS] -IDCAMS

Alternate 5nde/ for 1S!S


$he syntax and the "ara eters for 0&3& are the sa e as that for 9&3&# $he alternate index is not su""orted in Batch 4+B+: (+&,%& X %& II ) # 'lternate Index is used under 4I4& en*iron ent# Ste5s for s5ecif2ing t(e Alternate IndeD Pat( 'n exa "le to elucidate the ste"s necessary to s"ecify the "ath for an 'lternate Index is "ro*ided !elow# DEFINE PAT? 1NA,E 1-IND&NLT&FSA,&DEPT&PAT?3 PAT?ENTR4 1-IND&NLT&FSA,&DEPT&AI-3 UPDATE3 $ $ $

$he Pat( is a %&'M o!.ect though it doesnGt contain any records# $he co

and is the sa e for 9&3& X

0&3&# $he 1ath is used to lin7 F4: 3&; to %&'M 'I= (s"ecifies that the gi*en 'I= is to !e used)# NA,E $he syntax is NA,E 15at(na*e3 $he 1athna e !eco es the 3&; in the run F4: PAT?ENTR4 $he syntax is PAT?ENTR4 1entr2 na*e.5ass)ord3 $he Entr2na*e is the na e assigned to alternate index cluster# $his is required for an alternate index

$ath = A5@ = :ase Cluster relation

r"n 0CL S5ecifies Pat( Na*e Pat( Points to Alternate IndeD Alternate Index

AI- is related to a 8ase Cl"ster base Cl"ster 95? 5=.D $ath=A5@=Cluster relation

2se the "ath na e in F4:s for alternate indexes Ste5s for 8"ilding t(e IndeD $he following is the way to !uild the 'lternate Index# $he 8LDINDE- 4o and "o"ulates it with records CSC India Version 1.0 Page 45 of 49 and actually !uilds the index

VSAM

Access Method Services [AMS] -IDCAMS

$he standard F4: is as !elow8 ,,B:3I;3= ,&<&16I;$ ,,331 ,33,,I34%$1 ,,I34%$,,&<&I; B:3I;30= ,Z C+8+L M FSA, Mere we will discuss using %&'M with 4+B+: $he SELECT &tate ent $he *arious files +rganizations to !e s"ecified are I;30=03 for 9&3& &0Q20;$I': for 0&3& 60:'$I%0 for 663& 0=04 1/MRI34'M& 33 &<&+2$ R Z 33 3&;R=I;3#;:$#%&'M,3I&1R+:3 33 3&;R=I;3#;:$#%&'M#301$#'I=,3I&1R+:3 33 3&;R=I;3#;:$#I695I:01, 3I&1R+:3 33 3&;R=I;3#;:$#I695I:0-, 3I&1R+:3 33 Z I;5I:0 (331) +2$5I:0 (33-) -

I;$06;':&+6$

The various access modes that can be specified are &equential 6ando 3yna ic $he 6ecord 7ey is to !e s"ecified for 9&3& only# ERR+R ?ANDLIN# A two character FILE STATUS is used to control the error. `00 is success. Six character Request Parameter List (RPL) is used for VSAM specific error codes.

CSC India

Version 1.0

Page 46 of 49

VSAM FILE ?ANDLIN# $he 60'3

References

ust "recede a 30:0$0 for 9&3& if organization is &0Q20;$I':#

0xa "les for the a!o*e are "ro*ided !elow8 &0:04$ &$230;$-M'69& '&&I/; $+ &$23M'69 +R#ANIIATI+N IS INDE-ED.SESUENTIAL.RELATIFE ACCESS ,+DE IS SESUENTIAL.RAND+,.D4NA,IC REC+RD 7E4 IS F>1$STUDENT $ N+ ALTERNATE 7E4 IS F>1$,AR7 :<IT? DUPLICATES; FILE STATUS IS <S$,AR7$STATC <S$STAT$AREA>1 &0Q20;$I': I;30=03 60:'$I%0 RT RT RT +R#ANIIATI+N 0&3& 9&3& 663& ACCESS ,+DE o5tions

0&3& 8 &0Q20;$I': 9&3& 8 &0Q20;$I': or 6';3+M or 3<;'MI4 663&8 &0Q20;$I': or 6';3+M or 3<;'MI4 5I:0 &04$I+;

53 &$230;$ - M'69&# 01 501-&$23-M'69-604# 0A 501-&$230;$-;+ 0A 501-M'69 EDec"tion 0CL ,,&$23M'69 33 3&;R=I;3#;:$#&$23M'69,3I&1R&M6 <+R7IN#$ST+RA#E section 01 I&-&$'$2&-5I0:3& 0A I&-M'69&-&$'$ 0A I&-&$'$-'60'01 10 I&-&$'$1 10 I&-:IB-52;4 10 I&-:IB-53B'49 1I4 =(-) 1I4 9(1) 1I4 9(@) 1I4 == 1I4 9(A) 1I4 9(@)

CSC India

Version 1.0

Page 47 of 49

VSAM PR+CEDURE DIFISI+N +10; &$230;$-M'69& I;12$,+2$12$,I-+,0=$0;3

References

+10; 0=$0;3 on 9&3& requires each record 7ey to !e higher than the existing ax 7ey# If it is e "ty, I;12$, I-+ READ state*ent &equential 60'3 Sfile na eT '$ 0;3 Sstate entT 6ando Mo*e A@ to 501-&$230;$-;+ 60'3 &$230;$-M'69& I;%':I3 90< 3I&1:'< [I;%':I3 90< 4+;3I$I+;G &tatus code chec7ing Mo*e A@ to 501-&$230;$-;+ 60'3 &$230;$-M'69& I5 I&-M'69-&$'$ R [-@G 3I&1:'< [B'3 604+63G 0;3-I5 odes are not allowed

S3AR3 statement
Mo*e A@ to I&-&$'6$-%':20 &$'6$ &$230;$-M'69& 90<TR I&-&$'6$-%':20

R1WR531
60I6I$0 501-&$23-M'69-604 ;ote 8 Ie cannot change "ri ary 7ey !ut can lengthen the record

WR531
I6I$0 501-&$23-M'69&-604 I5 I&-M'69&-&$'$ R [--G 3I&1:'< [321:I4'$0 90<G 0;3-I5

CSC India

Version 1.0

Page 48 of 49

VSAM

References

C"6S1
4:+&0 &$230;$-M'69& I5 I&-M'69&-&$'$R[++G 4+;$I;20 0:&0 S'B0;3T 0;3-I5 Ie su +"en arize !elow the &tate ents allowed in different access odes of the files# +10; I;12$ +2$12$ I-+ &0Q20;$I': 60'3 I6I$0 60'3 I6I$0 60I6I$0 &$'6$ 30:0$0 6';3+M 60'3 I6I$0 60'3 I6I$0 60I6I$0 30:0$0 3<;'MI4 60'3 &$'6$ I6I$0 60'3 I6I$0 60I6I$0 &$'6$ 30:0$0 odes for different

CSC India

Version 1.0

Page 49 of 49

You might also like