Sunteți pe pagina 1din 28

Mainframe Refresher Part-1

VSAM-Page:1

VSAM (Virtual Storage Access Method) History Access Method is an interface bet een the a!!lication !rogram and !hysical o!eration of storage de"ices# $t is a com!onent of o!erating system# VSAM is the first access method that efficiently uses the "irtual storage of MVS# $t can mani!ulate only the data that resides on a %AS%# (%irect access storage de"ice) $&M introduced VSAM in 1'() as a re!lacement for se"eral e*isting access methods designed by it earlier# +S%S (+ey Se,uenced %ata Set) re!laced $SAM ($nde*ed Se,uential Access Method) RR%S (Relati"e Record %ata Set) re!laced &%AM (&asic %irect Access Method) -S%S (-ntry Se,uence %ata Set) !ro"ide same function as normal se,uential .SAM# (.ueued Se,uential Access Method)# $nitially VSAM had only -S%S and +S%S# RR%S and Alternate $nde* to +S%S are introduced in 1'('# %/0 -/ (%ata /acility e*tended /unction) VSAM as introduced in 1'(' ith $ntegrated 1atalog /acility ($1/) to re!lace the old VSAM catalog of the !re"ious "ersions# 2he latest "ersion of %/P0 VSAM released in 1''1 called %/P0VSAM )#) contains enhancements li3e "ariable record length su!!ort for RR%S and added %/SMS facilities# Ad"antages of VSAM o"er other access methods 1#%ata retrie"al ill be faster because of an efficiently organi4ed inde*# 2he inde* is small because it uses a 3ey com!ression algorithm# 5#$nsertion of records is easy due to embedded free s!ace in the cluster# )#Records can be !hysically deleted and the s!aces used by them can be used for storing other records ithout reorgani4ation# 6#VSAM datasets can be shared across the regions and systems# 7#%atasets can be !hysically distributed o"er "arious "olumes based on 3ey ranges# 8#VSAM is inde!endent of storage de"ice ty!es# (#$nformation about VSAM datasets is centrally stored in VSAM catalog# So referencing of any VSAM dataset need not be detailed in 91:# %isad"antages of VSAM 1#2o allo easy mani!ulation of records; free s!ace should be left in the dataset and this increases the s!aces re,uired# 5#$ntegrity of the dataset across the region and system need to be controlled by user#

Mainframe Refresher Part-1

VSAM-Page:5

1:<S2-R A cluster can be thought of as a logical dataset consisting of t o se!arate !hysical datasets: 1 2he data com!onent (contains the actual data)# 5 2he inde* com!onent (contains the actual inde*)# All ty!es of VSAM datasets are called clusters e"en though +S%S is the only ty!e that fulfills the cluster conce!t# -S%S and RR%S don=t ha"e $nde* com!onent# %ata 1om!onent# 1ontrol $nter"als and 1ontrol Areas VSAM stores records in the data com!onent of the 1luster in units called control inter"als# 2he control inter"al is the VSAM e,ui"alent for a bloc3 and it is the unit of data that is actually transmitted hen records are read or ritten# 2hus many logical records form a control inter"al and many control inter"als form a control area# 2he 1ontrol Area (1A) is a fi*ed length unit of contiguous %AS% storage containing a number of 1$ s# 2he control area is VSAM internal unit for allocating s!ace ithin a cluster# 2he !rimary and secondary allocations consist of some number of 1A# Minimum si4e of control area is 1 trac3 and ma*imum si4e is 1 cylinder# /ormat of 1ontrol $nter"al 2here are four se!arate areas ithin a control $nter"al# 1# :ogical Record Area (:RA) that contains the records# 5# /ree S!ace (/SP1)# 2his area can be used for adding ne records# )# <nused S!ace# As /SP1 may not be a multi!le of record length; there ill be al ays some unused s!ace in e"ery 1$# 2his can be minimi4ed for fi*ed length records by selecting !ro!er control inter"al si4e# 6# 1ontrol /ields# 1$%/ > 1ontrol $nter"al %efinition /ield - 6 bytes field containing information on free s!ace a"ailability in the control inter"al# ?ne !er control inter"al# R%/ > Record %efinition /ield > ) bytes field# /or fi*ed length records; there ill be 5 R%/; first contains the number of records in the control inter"al and the second contains record length# /or "ariable length records; the number of R%/ can "ary de!ending on ho many ad@acent records ha"e the same length in the 1$# $f no t o ad@acent records are of the same length; then one R%/ is needed to describe each record# $nde* 1om!onent (Se,uence Set and $nde* Set) &esides the data com!onent; VSAM creates an inde* com!onent# $nde* com!onent consists of inde* set and se,uence set# 2he se,uence set is the lo est le"el of the inde* is called the se,uence set and it contains !rimary 3eys and !ointers to the control inter"als of the data com!onent# 2here is one se,uence set for one control area# 2he highest record 3ey of e"ery control inter"al is stored in se,uence set# 2he highest record 3ey of the se,uence set is stored in first le"el of inde* set# &ased on the si4e of control inter"al of inde* com!onent; there ill be 1-) le"els of inde* sets in the inde* com!onent of the dataset#

Mainframe Refresher Part-1

VSAM-Page:)

1ontrol $nter"al and 1ontrol Area S!lit Ahen a VSAM dataset is created; the free s!ace !arameter defined can s!ecify a !ercentage of control inter"als to be left free during the load of VSAM file# :ater; hen you add a record to the VSAM file; according to the 3ey se,uence; it is !laced in a s!ecific control inter"al# &ut if the s!ecific control inter"al is already full; then this cannot be !laced in the se,uence# 2he result is 1ontrol $nter"al s!lit# $t mo"es half of the records in the filled control inter"al to any other free control inter"al a"ailable in the control area and ma3es room for the ne record in the right !lace# $f there is no free control inter"al e*ist in the control area; then half the control inter"als are mo"ed to ne control area and this is called control area s!lit# -*am!le 1# $n the e*am!le belo ; there are four control areas and e"ery control area contains t o control inter"als# 1ontrol fields are not sho n in the diagram# 2here should be one se,uence for e"ery control area# So there are four se,uence sets# 2here are t o le"els of inde* set# 2he second le"el of inde* set contains !ointers to se,uence set# 5# 1ontrol $nter"al S!lit: Ahen a record ith 3ey 55 is added in the !rogram; it should !hysically be stored bet een the e*isting records 51 and 5)# 51 and 5) are in the first control inter"al of control area-)# 2here is no more s!ace a"ailable to store this record# So control s!lit ill occurs# Record 5B and 51 continue to e*ist in the current control inter"al# Records 55 and 5) ill be mo"ed to any of the free control inter"als# $n our case control inter"al 5 is free# So they are mo"ed there and inde* set is accordingly u!dated# )# 1ontrol Area S!lit: Ahen a record ith 3ey ) in the !rogram; it should be !laced bet een 5 and 6# 2hese records are in first control inter"al of first control area and there is no free s!ace# So control inter"al s!lit is e*!ected# &ut there is no free control inter"al in the control area-1# So control area s!lit occur# Ce control area is allocated and half the records of control area-1 ill be mo"ed there and inde*es are !ro!erly u!dated# Ho inde* could ma3e the access fasterD $ faced an interesting ,uestion in an inter"ie # 2he ,uestion follo s: My se,uential file has 7B records# 2o get the 7Bth record; $ ha"e to read 6' data records and by!ass# $nde*es store !rimary 3eys ith actual location# So to read 7Bth record using inde*ed organi4ation; $ ha"e to get the location of 7Bth record from inde*# So $ ha"e to read and by!ass the location of 6' records# 2he only difference is in the second case is $ am doing se,uential read in inde* set instead of dataset# Ho do you say my inde* access ould be fasterD 2o ans er this ,uestion; you should 3no ho inde*es are organi4ed and read# Ae ha"e already seen ho they are organi4ed# $n the e*am!le belo ; to read the 7Bth record; first root inde* is read and identified that the record should be in the right hand side# $n the second $-?; $ ill get the se,uence and in third $-?; $ ill get the location of the record# $ ill get my record in the fourth $-? instead 71 $-?# (7B $? in inde* and 1 $-? for getting the data) $f $ am accessing the first record; then se,uential read needs only one $-? but ob"iously my random read needs more# So e !refer inde*ed organi4ation only hen the number of records is significant#

Mainframe Refresher Part-1

VSAM-Page:6

F 1(

F7B

Root $nde* /irst :e"el $nde* Se,uence set

FG

F1(

F 5)

F7B

F6

FG

F16

F1(

F5)

F)7

F7B

1 7

5 (

6 G

15 16 1(

5B 51 5)

)) )7 7B

%ata 1om!onent

1A-1

1A-5

1A-)

1A-6

Pro!erties of VSAM datasets Pro!erties of -S%S; +S%S and RR%S are listed a tabular format in the ne*t !age# 2hough the table says RR%S records should be of fi*ed length; MVS0%/P VSAM Version )#) allo s "ariable length RR%S# VSAM internally im!lements it using +S%S# VSAM :%S Pro!erties: :inear datasets ha"e no records# 2hey are @ust long strings of bytes# Since it is a long string of bytes an :%S has no /SP1; <S; 1$%/ and R%/# 2he 1$SE is al ays 63 bytes# 2he main use of :%S is to im!lement other data access organi4ations es!ecially a relational database system li3e %&5# As the data in an :%S is mani!ulated the o!erating system automatically !ages in and out the !ortions of the dataset being or3ed on# 2he dataset is addressed by the R&A as if it ere in memory and the system !ages the needed !ages in and out# 2hus the !rocess is "ery sim!le and fast# -S%S differs from .SAM file in the follo ing ays: 1# .SAM can be created o"er 2AP- hereas -S%S cannot reside on 2AP-# 5# Alternate $nde* can be created o"er -S%S# 2his alternate inde* has alternate 3ey ma!!ed ith R&A# So $nde*ed and Random access are !ossible using the alternate $nde* in -S%S hereas it is not !ossible ith .SAM#

Mainframe Refresher Part-1

VSAM-Page:7

1om!arison of -S%S; +S%S and RR%S 1haracteristics -ntry Se,uence Access -S%S &ased on entry se,uence ?nly Se,uential access is !ossible# +S%S &ased on collating se,uence by 3ey field Se,uential and random access is !ossible# Random access is thru !rimary0alternate 3ey# May ha"e one or more alternate inde*es# RR%S &ased on relati"e record number order 1an be accessed directly using relati"e record number; hich ser"es as address# Cot a!!licable

Alternate $C%-H

:ocation of the record /ree S!ace

May ha"e one or more alternate inde*es# &ut cannot be used in &A21H 1?&?:# 1an be used in 1$1S 1?&?:# A record R&A cannot be changed -*ist at the end of the dataset to add records#

A record R&A can be changed# %istributed free s!ace for inserting records in bet een or change the length of e*isting record# %-:-2- is !ossible# /i*ed or Variable Possible -asy RAC%?M access and most !o!ular method A!!lications that re,uire each record to ha"e a 3ey field and re,uire both direct and se,uential access# -*: &an3ing a!!lication

A relati"e record number can be changed# /ree slots are a"ailable for adding records at their location# %-:-2- is !ossible# /i*ed# Cot !ossible /astest access method# A!!lications that re,uire only direct access# 2here should be a field in the record that can be easily ma!!ed to RRC#

%eletion Record Si4e SPACC-% records S!eciality Preference

1annot be deleted# R-AR$2- of same length is !ossible# /i*ed or Variable Possible ?ccu!ies less S!ace A!!lication that re,uire se,uential access only# -*: PAIR?:: PR?1-SS$CJ#

Mainframe Refresher Part-1

VSAM-Page:8

IDC Access Method Ser"ices ($%1AMS) AMS is used to !erform "arious functions on VSAM datasets and catalogs# AMS has got a utility !rogram called $%1AMS# 2he functions of AMS are !erformed using the different functional commands of $%1AMS# $t can be in"o3ed in the follo ing three ays: 1# &atch mode ith 91: statements# 5# $nteracti"ely ith 2S? commands# )# 1alls from an a!!lication !rogram# $m!ortant functional commands of $%1AMS are: 1# 5# )# 6# 7# 8# (# %-/$CA:2-R PR$C2 %-:-2:$S21A2 R-PR? -HP?R2 and > 2o create ob@ects > +S%S0-S%S0RR%S0J%J0VSAMSPA1- etc - 2o alter the !arameters of the ob@ect already e*ists# - 2o !rint and "ie the selected records of dataset# > %elete the ob@ects# > Vie the com!lete information about any ob@ect# - 1o!y0Restore0Merge <tility for VSAM and C?C-VSAM files# $MP?R2 > 1o!y and restore datasets across the system# > 2o !ro!erly close the unclosed0A&-C%-% VSAM dataset#

G# V-R$/I

Sam!le $%1AMS 91: 009S1B -H-1 PJMK$%1AMS;R-J$?CK1B56+; PARMK!arameters 00S2-P1A2 %% %SCK##;%$SPKSHR ?!tional S2-P1A2 00SISPR$C2 %% SIS?<2KF $%1AMS Messages 00SIS$C %% F 1ontrol statements 0F 00 Juidelines for coding commands 1# At least one blan3 s!ace must be there bet een the command and the ob@ect and bet een sub !arameter "alues# 5# A s!ace is o!tional bet een a !arameter and the !arenthesis enclosing its "alues# )# Sub-!arameter "alues can be se!arated using a s!ace or a comma# 6# Multi!le !arameters can be coded on a line but it is better to !lace each on a line by itself for better readability# 7# A !arameter and a sub-!arameter cannot be se!arated ith a hy!hen# A !lus sign should be used for this !ur!ose# Meaning of /$:- and %A2AS-2 in AMS commands 1# +ey ord /$:- should !oint to %%CAM- and it is logical# 2here should be ma!!ing of the %%CAM- ith actual dataset# 9-S allocates the datasets associated ith the file @ust before the e*ecution of ste!# 5# +ey ord L%A2AS-2= should directly !oint to the !hysical dataset and $%1AMS allocates this file dynamically for o!eration#

Mainframe Refresher Part-1

VSAM-Page:(

%-/$C- 1:<S2-R 2his command is used to create and name a VSAM 1luster# &asic Parameters for %efine 1luster %-/$C- 1:<S2-R-CAM2his !arameter s!ecifies name to the VSAM cluster# 2he cluster name becomes the dataset name in any 91: that in"o3es the cluster 00 $CP<2 %% %SCK SMSH:G8#2-S2#VSAM; %$SPKSHR 2he name for a VSAM dataset can include u! to 66 al!hanumeric characters# Ahen the data and inde* !arameters are coded to create the data and inde* com!onents; the name !arameter is coded for them as ell# $f the name !arameter is omitted for the data and inde* VSAM tries to a!!end !art of #%A2A or #$C%-H as a!!ro!riate as the lo le"el ,ualifier de!ending on ho many characters the dataset name contains already and still staying ithin the 66 character limit# $f data and inde* com!onents are named; !arameter "alues can be a!!lied se!arately# 2his gi"es !erformance ad"antages for large datasets# %-/$C- 1:<S2-R-%A2A 1?MP?C-C2 2he data !arameter instructs $%1AMS that a se!arate data com!onent is to be created# %ata is o!tional but if coded must follo all !arameters that a!!ly to the cluster as a hole# 2here are se"eral o!tions for the data !arameter but name is the most common# %-/$C- 1:<S2-R-$C%-H 1?MP?C-C2 2he inde* !arameter creates a se!arate inde* com!onent# $nde* is o!tional but if coded must follo all of the !arameters that a!!ly only to the data com!onent# -S%S and RR%S must not ha"e $C%-H !art# %-/$C- 1:<S2-R-SPA1- Allocation A VSAM dataset can ha"e 15) e*tents in a V?:<M-# Primary s!ace is allocated initially hen the dataset is created and based on re,uest secondary s!ace ill be allocated# $n the best case; you ill get (!rimary M155 F secondary)# Refer the 91: section-SPA1- !arameter section for more details on -H2-C2S# VSAM calculates the control area si4e internally# 1ontrol area can of one cylinder; the largest !ermitted by VSAM; usually yields the best !erformance# So it is al ays better to allocate s!ace in cylinders because this ensures a 1A si4e of one cylinder# 2he R-1?R%S !arameter is used to allocate s!ace in units of records for small datasets# Ahen this is done the R-1?R%S$E- !arameter must be s!ecified# $f allocation is s!ecified in units of +$:?&I2-S or M-JA&I2-S VSAM reser"es s!ace on the minimum number of trac3s it needs to satisfy the re,uest# Synta*: <C$2(!rimary secondary) <C$2 can be 1I:01I:$C%-RS 2R+02RA1+S R-10R-1?R%S% +&0+$:?&I2-S M&0M-JA&I2-S

Mainframe Refresher Part-1

VSAM-Page:G

%-/$C- 1:<S2-R-V?:<M-S Parameter 2he "olumes !arameter assigns one or more storage "olumes to the dataset# Multi!le "olumes can be s!ecified and if so; they must be of the same de"ice ty!e# 2he data and inde* com!onents can be stored in se!arate "olumes to !ro"ide a !erformance ad"antage for large datasets# V?:<M-S("olser) ?R V?:<M-S("olser1 "olser5) %-/$C- 1:<S2-R-R-1?R%S$E- Parameter (R-1SE) 2he record si4e !arameters s!ecify VSAM hat records to e*!ect# 2he AVJ and MAH are the a"erage and ma*imum "alues for "ariable length records# $f records are of fi*ed length AVJ and MAH can be the same# Record si4e can be assigned at the cluster or data le"el# Synta*: R-1?R%S$E-(AVJ MAH) %-/$C- 1:<S2-R- +-IS Parameter 2he 3eys !arameter defines the length and offset of the !rimary 3ey in a +S%S record# 2he offset is the !rimary 3ey=s dis!lacement in bytes from the beginning of the record# 2his !arameter is defined for a +S%S only# %efault is +-IS(86 B)# Synta*: +-IS(length offset) %-/$C- 1:<S2-R- %ataset 2y!e Parameter 2he dataset ty!e !arameter s!ecifies hether the dataset is $C%-H-%(+S%S) ; C?C$C%-H-%(-S%S); C<M&-R-%(RR%S) ?R :$C-AR (:%S)# $C%-H-% ($H%) s!ecifies a +S%S and it is the %-/A<:2# Ahen this !arameter is s!ecified VSAM automatically creates and catalogs an inde* (if other !arameters li3e 3eys are "alid)# $nde*ed is also used for a "ariable length RR%S# C?C$C%-H-%(C$H%) hen s!ecified denotes an -S%S# Co inde* is created and records are accessed se,uentially or by their relati"e byte address (R&A)# C<M&-R-% (C<M%) s!ecifies an RR%S and :$C-AR s!ecifies an :%S# Performance Parameters /or %-/$C- 1:<S2-R 2he !erformance !arameters are coded in the %-/$C- 1:<S2-R command to 1# Reduce the amount of !hysical $-?# 5# Ma3e necessary $-? faster# )# ?!timi4e dis3 utili4ation# %-/$C- 1:<S2-R- 1?C2R?: $C2-RVA: S$E- Parameter 2he si4e of the 1$ is s!ecified by the 1$SE !arameter# 2he si4e of the 1$ is s!ecified in bytes and it should be a multi!le of 715 or 5B6G de!ending on the ty!e of catalog ($1/ or VSAM) and the length of the record# /or datasets cataloged in $1/ catalogs the control inter"al should be a multi!le of 715 bytes ith a range of 715 to )5(8G bytes# /or datasets cataloged in VSAM catalogs; the data 1$SE must be a multi!le of 715 if records are of G1'5 bytes or less; and a multi!le of 5B6G if records are of more than G1'5 bytes# $f a 1$SE; hich is not a multi!le of the abo"e t o is assigned VSAM rounds the 1$SE "alue u! to the ne*t highest multi!le if necessary#

Mainframe Refresher Part-1

VSAM-Page:'

&est control inter"al si4e selection /or se,uential !rocessing of a +S%S; a relati"ely large 1$SE ill reduce !hysical $0? by 3ee!ing more records accessible in the buffers# ?n the other hand; for random !rocessing of a +S%S a smaller 1$SE ould re,uire lesser data transfer time and fe er buffers; thus ma3ing $0? faster# /or an -S%S (since it is !rocessed se,uentially) the 1$SE should be relati"ely large de!ending on the si4e of the record# Since an RR%S is !rocessed randomly the 1$SE should be relati"ely small# 2he /R--SPA1- Parameter (/SP1) 2he /R--SPA1- !arameter is a!!licable to the +S%S and the "ariable-length RR%S only# /R--SPA1- cannot be assigned to an -S%S because all ne records are added to the end of the dataset# 2his !arameter allocates some !ercentage of both the 1$ and 1A for !lanned free s!ace; hich can be used for adding ne records or e*!anding e*isting "ariable records# 2he !arameter is coded as follo s /R--SPA1-(ciN caN) /R--SPA1-(ciN ) control inter"al only /R--SPA1-(B caN) control area only /R--SPA1-(B B) is the default# /R--SPA1-(1BB 1BB) means only one record ill be loaded in e"ery control inter"al and only one control inter"al ill be loaded in e"ery control area# $n order to effecti"ely allocate /R--SPA1- the follo ing factors ha"e to be ta3en into consideration# 1# 2he e*!ected rate of gro th: $f e"en gro th is e*!ected a!!ly /R--SPA1- to both 1$ and 1A# $f une"en gro th is e*!ected a!!ly /R--SPA1- only to the 1A# 5# 2he e*!ected number of records to be deleted# )# Ho often the dataset ill be reorgani4ed ith R-PR?# 6# 2he !erformance re,uirements# 2he 1$ /R--SPA1- allocation should be enough to co"er the length of one record !lus any additional R%/s that may result from a "ariable record length# %-/$C- 1:<S2-R- SP--% And R-1?V-RI Parameters R-1?V-RI !re formats a VSAM dataset at the time of initial load or resume load# $t ta3es longer time to load the dataset through R-1?V-RI than through SP--% hich does not !re format the dataset# Ho e"er if the load o!eration is aborted in the middle; R-1?V-RI enables resum!tion immediately after the last record loaded# $f SP--% is s!ecified load ill ha"e to be restarted from the beginning# SP--% is highly recommended because it ill s!eed u! the initial data load#

Mainframe Refresher Part-1

VSAM-Page:1B

2he &<//-RSPA1- Parameter (&</SP) &y default; VSAM allocates t o data buffers for all ty!es of datasets# ?ne data buffer for !rocessing and reser"es the second for !otential s!lit acti"ity# $n addition to this; it ould allocate one inde* buffer for a +S%S# 2his !arameter is used to o"erride the default "alues# 2he &<//-RSPA1!arameter re!resents the amount of storage in bytes re,uired to !rocess the contents of a minimum of one 1$ orth of data# Synta*: &<//-RSPA1-(bytes) /or se,uential !rocessing more number of data buffers need to be allocated# /or random !rocessing more inde* buffers may be re,uired; at least one for each le"el of the inde*# /or dynamic !rocessing additional data and inde* buffers are re,uired in !ro!ortion to the ratio of se,uential and random !rocessing !lanned# 2he &</SP "alue !ro"ided gets translated into data buffers for an -S%S or RR%S# &ut for a +S%S; VSAM decides on the number of data and inde* buffers based on the access method s!ecified in the a!!lication !rogram# $f &</SP is s!ecified in the %-/$C- 1:<S2-R command; all a!!lications that use the dataset can use only this allocation unless they o"erride it in the &</SP sub !arameter of the Access Method Parameter of 91:# %-/$C- 1:<S2-R-SPACC-% Parameter (SPC%) 2he SPACC-% !arameter allo s large records to s!an more than one 1$# $f ma*imum record length is more than the 1$ si4e s!ecified; allocation ill fail unless the SPACC-% !arameter is s!ecified# Ho e"er records cannot s!an across control areas# 2he resulting free s!ace in the s!anned 1$ is unusable by other records e"en if they fit logically in the unused bytes# C?CSPACC-% is the default# $t can be s!ecified for -S%S and +S%S only# %-/$C- 1:<S2-R-2he +-IRACJ-S Parameter (+IRCJ) 2he +-IRACJ-S !arameter di"ides a large dataset among se"eral "olumes# 2he "olumes in hich the records are to be !laced are s!ecified using the V?:<M-S !arameter# <nless the +-IRACJ-S !arameter is s!ecified ith the ?R%-R-% !arameter; the records are assigned randomly to the "olumes# 2hese !arameters are illustrated by the follo ing e*am!le %-/$C- 1:<S2-R (CAM-(C21$#V#<-6#A5BBBB#2)B#AV#%A5BBBB8) 1I:(7 1) +-IS(G B) R-1SE(GB GB) +-IRACJ-S ((BBBBBBB1 5'''''') ()BBBBBBB 6(BBBBB) (6(BBBBB1 ''''''')) V?:<M-S (C22S?& C22S?9 C22S?7) ?R%-R-% C?R-<S$C%-H-% O O O more !arameters -

Ahen the ?R%-R-% !arameter is coded the number of V?:<M-S and +-IRACJ-S must be the same#

Mainframe Refresher Part-1

VSAM-Page:11

%-/$C- 1:<S2-R- R-<S- Parameter (R<S) 2his s!ecifies that a cluster can be o!ened again and again as a reusable cluster# $t means; hene"er you o!en the dataset in ?<2P<2 mode; all the records that are already e*ist in the dataset are logically deleted# C?R-<S- (<CR<S) is the default and s!ecifies the cluster as non-reusable# A cluster cannot be reused if 1# +-IRACJ-S !arameter is coded for it 5# An alternate inde* is built for it )# 2he cluster has its o n data s!ace in both the VSAM and $1/ catalog en"ironments# %-/$C- 1:<S2-R-$M&-% And R-P:$1A2- Parameters ($M&%0 R-P:) 2hese !arameters are a!!licable to a +S%S only# 2he $M&-% !arameter im!lies that the se,uence set (lo ermost le"el) of the inde* com!onent of a +S%S ill be !laced on the first trac3 of a data com!onent 1A and ill be du!licated as many times as !ossible on that trac3# Ahat $M&-% does for a se,uence set R-P:$1A2- does for an inde* set# 2he R-P:$1A2- !arameter forces each 1$ of the inde* set of the inde* com!onent to be ritten on a se!arate trac3 and re!licated as many times as !ossible# 2his !arameter reduces rotational delay hen VSAM is accessing high-le"el inde* 1$# 2he $M&-% o!tion reduces the see3 time it ta3es for the read- rite head to mo"e from the inde* to the data com!onent and the re!lication factor reduces the rotational delay of the re"ol"ing dis3# C?$M&-%(C$M&%) and C?R-P:$1A2-(CR-P:) are the defaults# %-/$C- 1:<S2-R-AR$2-1H-1+ Parameter (A1+) 2his !arameter instructs VSAM to in"o3e a %AS% "erify facility hene"er a record is ritten# C?AR$2-1H-1+ (CA1+) is the default and !ro"ides no %AS% "erification# Since contem!orary %AS% de"ices are "ery reliable and because of the high !erformance o"erhead associated ith this !arameter it is better to acce!t the C?AR$2-1H-1+ o!tion# %-/$C- 1:<S2-R-SHAR-?P2$?CS Parameter 2his !arameter s!ecifies ho a VSAM dataset can be shared across the regions and across the system# %efault "alue is (1 )) Synta*: SHAR-?P2$?CS(cross-region 2y!e 1R 1R 1R 1S 1S Value 1 5 ) 6 cross-system)

Meaning R-A% and AR$2- $ntegrity# Any number of @obs can read the dataset ?R only one @ob can rite to the dataset# ?C:I AR$2- $ntegrity# Any number of @obs can read the dataset AC% one @ob can rite to the dataset# C? $ntegrity# /ile is fully shared# $t is !rogrammer res!onsibility to ta3e !ro!er loc3 o"er the file before use# %efault "alue for 1S# Same as ) but additionally forces a buffer refresh for each random access#

Mainframe Refresher Part-1

VSAM-Page:15

%-/$C- 1:<S2-R--RAS- Parameter 2he -RAS- !arameter instructs VSAM to o"er rite sensiti"e data ith binary 4eroes hen the cluster is deleted# C?-RAS- is the default and it means that the deleted cluster is not to be o"er ritten ith binary 4eroes# -RAS- can be coded at the cluster or data le"el# Ahen a!!lied to the cluster le"el it refers only to the data com!onent since the inde* com!onent contains only 3eys and not data# -RAS- can be s!ecified ith the A:2-R and %-:-2- commands# -RAS- !ro"ided ith %-:-2- o"errides both %-/$C- and A:2-R s!ecifications# Pass ord Protection VSAM datasets can be !ass ord !rotected at four different le"els# -ach le"el gi"es a different access ca!ability to the dataset# 2he le"els are 1# R-A%PA- !ro"ides read only ca!ability# 5# <P%A2-PA- records may be read; u!dated ; added or deleted at this le"el# )# 1?C2R?:PA- !ro"ides the !rogrammer ith the access ca!abilities of R-A%PA and <P%A2-PA# 6# MAS2-RPA- all the abo"e o!erations !lus the authority to delete the dataset is !ro"ided# Pass ords !ro"ided at the cluster le"el !rotect only if access re,uires using the cluster=s name as dataset name# 2herefore it is ad"isable to !rotect the data and inde* com!onents using !ass ords because someone could other ise access them by name# Another feature of MVS called Resource Access 1ontrol /acility (RA1/) ignores VSAM !ass ords and im!oses its o n security and for most VSAM datasets RA1/ security is sufficient# 2he A22-MP2S !arameter coded ith the !ass ord !arameters s!ecifies the number of attem!ts !ermitted for the o!erator to enter the !ass ord before abending the ste!# 2he 1?%- !arameter allo s for the s!ecification of a code to dis!lay to the o!erator in !lace of the entry name !rom!t# 2he A<2H?R$EA2$?C !arameter !ro"ides for additional security by naming an assembler <ser Security Verification Routine (<SVR)# 2he sub !arameter for this enclosed in !arenthesis is the entry !oint of the routine# 2? And /?R Parameters Ahen a dataset is allocated by Access Method Ser"ices the 2? and /?R !arameters are t o mutually e*clusi"e !arameters gi"en to s!ecify the retention !eriod of the cluster being defined# 2?(II%%%) or /?R(nnnn) II%%% is 9ulian date P nnnn can be 1-''''

Mainframe Refresher Part-1

VSAM-Page:1)

About 1A2A:?J !arameter Most of the AMS commands !ro"ide 1A2A:?J o!tion# $f the command is %-/$C-; then the dataset being defined ill be !laced in the catalog; mentioned in the 1A2A:?J !arameter# Similarly hile accessing the dataset; 1# 2he dataset is first searched in the catalog mentioned in 1A2A:?J !arameter# 5# $f 1A2A:?J is not coded; then the dataset is searched into the catalog coded in S2-P1A2 or 9?&1A2 catalog# )# $f there is no S2-P1A2 and 9?&1A2; then the dataset is searched in the user catalog corres!onding to the high le"el ,ualifier of the dataset# 6# $f there is no user catalog found; then the dataset is loo3ed into system catalog# 7# $f the dataset is not listed in system catalog also; then you ill get the error message of dataset not found# 2here ill be one master catalog and n number of user catalogs in the system# -"ery user catalog should ha"e an entry in master catalog# +S%S--S%S-RR%S-:%S Sam!le %efinitions

KSDS Definition //KSDSMAKE EXEC PGM=IDCAMS //SYSPRINT DD SYSOUT=A //SYSIN DD* DEFINE CLUSTER (NAME(EMPLOYEE KSDS CLUSTER! "OLUMES("SAM#$! CYLINDERS($%&! CONTROL INTER"AL SI'E((#)*! FREESPACE(10,20) KEYS(9,0) RECORDSI'E(+#%+#!! DATA (NAME(EMPLOYEE KSDS DATA!! INDEX (NAME(EMPLOYEE KSDS INDEX!! CONTROL INTER"AL SI'E(&#$(! CATALOG("SAM USERCAT T,O! /*

ESDS Definition //ESDSMAKE EXEC PGM=IDCAMS //SYSPRINT DD SYSOUT=A //SYSIN DD* DEFINE CLUSTER (NAME (EMPLOYEE ESDS CLUSTER! "OLUMES ("SAM#$! CYLINDERS ($%&! CONTROLINTER"ALSI'E ((#)*! RECORDSI'E (+#%+#! NONINDEXED! DATA (NAME (EMPLOYEE KSDS DATA!! CATALOG ("SAM USERCAT T,O! /*

RRDS Definition //RRDSMAKE EXEC PGM=IDCAMS //SYSPRINT DD SYSOUT=A //SYSIN DD* DEFINE CLUSTER (NAME(EMPLOYEE RRDS CLUSTER! "OLUMES("SAM#$! CYLINDERS($%&! CONTROL INTER"AL SI'E((#)*! RECORDSI'E(+#%+#! NUMBERED! DATA (NAME(EMPLOYEE KSDS DATA!! CATALOG("SAM USERCAT T,O! /*

LDS Definition //LDSMAKE EXEC PGM=IDCAMS //SYSPRINT DD SYSOUT=A //SYSIN DD* DEFINE CLUSTER (NAME(EMPLOYEE RRDS CLUSTER! "OLUMES("SAM#$! CYLINDERS($%&! LINEAR! DATA (NAME(EMPLOYEE KSDS DATA!! CATALOG("SAM USERCAT T,O! /*

Mainframe Refresher Part-1

VSAM-Page:16

$%1AMS - R-PR? command $t is the general-!ur!ose command that can o!erate on both VSAM and nonVSAM datasets# $t !erforms three basic functions: 1# $t loads an em!ty VSAM cluster ith records# 2he data and inde* com!onents for +S%S are built automatically# 5# $t creates a bac3u! of a VSAM dataset on a !hysical se,uential dataset and later it can be used for restore0rebuild the VSAM dataset# )# $t merges data from t o VSAM datasets# 1ommand Synta* R-PR? $C/$:-(%%CAM-) Q $C%A2AS-2(%A2AS-2-CAM-) ?<2/$:-(%%CAM-) Q ?<2%A2AS-2(%A2AS-2-CAM-) o!tional !arameters -

$C/$:-0$C%A2AS-2 and ?<2/$:-0?<2%A2AS-2 !oint to in!ut and out!ut datasets# Ahen loading a +S%S using R-PR?; the in!ut data should be first sorted in ascending se,uence by the field that ill become the !rimary 3ey in the out!ut dataset# Ahen loading an -S%S the sort ste! can be eliminated since the records are loaded in entry se,uence# /or an RR%S; the records are loaded in relati"e record se,uence starting ith 1# 2he dataset should be sorted on the field that correlates to the relati"e record number# R-PR? Record Selection R-PR? can be used for selecti"e co!ying# Ahere to start R-PR? Ahere to sto! R-PR? Valid /or /R?M+-I(R-1-+-I) 2?+-I(R-1-+-I) +S%S; $SAM /R?MA%%R-SS(RA&) 2?A%%R-SS(R&A) +S%S; -S%S /R?MC<M&-R(RRC) 2?C<M&-R(RRC) RR%S S+$P(number) 1?<C2(number) +S%S ; -S%S; RR%S S+$P refers to the number of in!ut records to s3i! before beginning to co!y and 1?<C2 s!ecifies the number of out!ut records to co!y# 2he R-<S- Parameter Aith R-PR? 2he R-<S- o!tion of R-PR? ill logically delete the e*isting records of a target +S%S; -S%S or RR%S and add ne records from the source dataset as if the target dataset ere em!ty# $n other ords R-<S- sets the "alue of the ending R&A of the Highest <sed control area in the data com!onent (H<R&A) to 4ero# $n order to use R-<S- ith R-PR? it is a !rere,uisite that the target dataset must ha"e been defined ith the R-<S- o!tion in the %-/$C- 1:<S2-R command# Merging %A2AS-2S <sing R-PR? and R-P:A1- o!tion 2he R-PR? command can be used for merging t o datasets into one# 2he target dataset can be a non-em!ty +S%S; -S%S or RR%S# 2he in!ut dataset can be any organi4ation if the target dataset is a +S%S or -S%S# Ho e"er if the target dataset is an RR%S the source dataset has to be an RR%S# +S%S to +S%S is the most common a!!lication of this merge techni,ue# $f the R-P:A1- o!tion is s!ecified as !art of the R-PR? command then records ith du!licate !rimary 3eys (for a +S%S) and du!licate relati"e record numbers (in the case of an RR%S) ill be re!laced#

Mainframe Refresher Part-1

VSAM-Page:17

$%1AMS - PR$C2 1ommand $t is used to !rint the contents of a dataset# 2he out!ut can be made a"ailable in "arious formats# 2his section deals ith the PR$C2 command and its "arious mutually e*clusi"e o!tions# PR$C2 $C%A2AS-2(data set-name) Q $C/$:-(dd-name) o!tions PR$C2 - 1HAR0 H-H0%<MP 2his s!ecifies the format in hich to !rint# 1HARA12-R(1HAR) !rints as -&1%$1; 15B characters !er line# 2his format is mostly used for al!hanumeric data# Any combination of bits that does not corres!ond to a !rintable character ill be !rinted as a !eriod# $f length of the record is greater than 15B characters; it is !rinted in bloc3s of 15B characters !er line# H-H format !rints each character in the dataset as t o he*adecimal digits# A ma*imum of 15B he*adecimal digits are !rinted on each line; an e,ui"alent of 8B characters# %<MP format is a combination of the character and he* formats# -ach character is !rinted both as a character and as the corres!onding he* re!resentation# -ach !rint line consists of 86 he* digits and the )5 related characters# $f the record length is greater than )5 characters the rest of the record is !rinted in bloc3s of 86 he* digits and )5 corres!onding characters !er line# PR$C2 > S+$P; 1?<C2; /R?M and 2? 2he records to be !rinted can be selected in the same selected in R-PR? to 1?PI# Ahere to start Printing S+$P(number) /R?M+-I(3ey-"alue) /R?MA%%R-SS(rba) /R?MC<M&-R(rrn) Ahere to sto! Printing 1?<C2(number) 2?+-I(3ey-"alue) 2?A%%R-SS(rba) 2?C<M&-R(rrn) ay records are

Ahere <sed +S%S; -S%S; RR%S; non-VSAM +S%S; A:2-RCA2- $C%-H +S%S; -S%S RR%S

A command that !rints records 5'; )B; and )1 in character format PR$C2 $C%A2AS-2(MMB1#1<S2?M-R#MAS2-R) 1HARA12-R S+$P(5G) 1?<C2()) -

-m!ty file- chec3 $f the file is em!ty; PR$C2 1?<C2(1) ends ith return-code as 6# PR$C2 $C%A2AS-2(?<2P<2#%SC) 1HARA12-R 1?<C2(1)

Mainframe Refresher Part-1

VSAM-Page:18

$%1AMS - %-:-2- 1ommand 2he %-:-2- command can be used to delete both VSAM and non-VSAM ob@ects# Synta*: %-:-2- -C2RI CAM- ?&9-12 o!tional-!arameters ?&9-12- 1:<S2-R J%J PA2H A$H A:$AS 1A2A:?J C?CVSAM SPA1<S-R1A2A:?J ?!tions > -RAS-0C?-RAS- P<RJ-0C?P<RJ- S1RA21H0C?S1RA21H /$:- /?R1-0C?/?R1%-:-2-- -C2RI CAM2he name of the entry to delete is coded# J-C-R$1 CAM-S can be also gi"en# %-:-2- - -RAS- (-RAS) 0 C?-RAS- (C-RAS) Ahen the %-:-2- command is e*ecuted it does not !hysically delete a dataset# ?nly its $1/ or VSAM catalog entry is remo"ed ma3ing this s!ace a"ailable for future use# 2he data com!onent remains on the dis3 until another dataset is allocated on the same s!ot# $f the %-:-2- command is e*ecuted ith the -RAS- o!tion; not only ill the entry be remo"ed from the catalog but also the data com!onent ill immediately be o"er ritten ith binary 4eroes# 2his o!tion is coded for sensiti"e data files# %-:-2- - P<RJ-(PRJ) 0 C?P<RJ- (CPRJ) C?P<RJ- s!ecifies that the entry not to be deleted if the retention !eriod has not e*!ired# (%efault)# So %-:-2- command don=t delete the dataset before e*!iry date# P<RJ- !arameter must be coded to delete the dataset before retention !eriod# %-:-2- - S1RA21H(S1R) 0 C?S1RA21H(CS1R) Ahen a dataset is created; it ill be listed in the catalog as ell as the V2?1 of the %AS%# S1RA21H s!ecifies that the dataset to be remo"ed from V2?1 as ell as catalog# C?S1RA21H s!ecifies that the dataset to be remo"ed from the catalog alone# %-:-2- - /?R1-(/R1)0C?/?R1-(C/R1) $t s!ecifies hether ob@ects that are not em!ty should be deleted# /?R1- allo s you to delete data s!aces; generation data grou!s; and user catalogs ithout first ensuring that these ob@ects are em!ty# C?/?R1- causes the %-:-2- command to terminate hen you re,uest the deletion of a data s!ace; generation data grou!; or catalog that is not em!ty# %-:2- - /$:-(%%CAM-) $t s!ecifies the name of the %% statement that identifies: 1# 2he "olume that contains a uni,ue data set to be deleted# 5# 2he !artitioned data set from hich a member (or members) is to be deleted# )# 2he data set to be deleted if -RAS- is s!ecified# 6# 2he "olume that contains the data s!ace to be deleted# 7# 2he catalog reco"ery "olume(s) hen the entry being deleted is in a reco"erable catalog# $f the "olumes are of a different de"ice ty!e; concatenated %% statements must be used# 2he catalog reco"ery "olume is the "olume hose reco"ery s!ace contains a co!y of the entry being deleted#

Mainframe Refresher Part-1

VSAM-Page:1(

$%1AMS - :$S21A2 1ommand 2he out!ut of this command gi"es an insight into the inner functioning of VSAM# :$S21A2 is used to "ie dataset attributes; !ass ord P security information; usage statistics; s!ace allocation information; creation and e*!iration dates and much more# :$S21A2 stands for :$S2ing a 1A2alog entry# $t is useful for listing attributes and characteristics of all VSAM and non-VSAM ob@ects cataloged in a VSAM or $1/ catalog# Such ob@ects can be the catalog itself; its aliases; the "olumes it o ns; clusters; alternate inde*es; !aths; J%J=s; non-VSAM files etc# 2he listing also !ro"ides statistics about a VSAM ob@ect from the time of its allocation; namely the number of 1$ and 1A s!lits; the number of $0? on inde* and data com!onents; the number of records added; deleted and retrie"ed besides other useful information# Synta*: :$S21A2 -C2R$-S(?&9-12-CAM-) A::QA::?1A2$?CQV?:<M-QH$S2?RIQCAMParameter CAMH$S2?RI V?:<MA::?1A2$?C Meaning :ist the name and ty!e of entry# :ists reference information for the ob@ect including name; ty!e of entry; creation and e*!iration date and the release of VSAM under hich it as created# :ists the de"ice ty!e and one or more "olume serial number of the storage "olumes here the dataset resides# H$S2?RI information is also listed# :ists information that has been s!ecified for s!ace allocation including the unit(cylinders; trac3s etc#); number of allocated units of !rimary and secondary s!ace and actual e*tents# 2his is dis!layed only for data and inde* com!onent entries# $f A::?1A2$?C is s!ecified V?:<M- and H$S2?RI are included# All the abo"e details are listed

A::

:-V-: Parameter in :$S21A2 :$S21A2 -C2R$-S(SMSH:G8#F) A:: 2his ill return com!lete information about all ob@ects ha"ing t o le"els of ,ualification and ha"ing the first ,ualifier SMSH:G8# &ut if e re,uire information about all ob@ects ha"ing the high le"el ,ualifier SMSH:G8; e ha"e to use the :-V-: !arameter# :$S21A2 :-V-:(SMSH:G8#F) A:: -*am!le 00SMSH:G81 9?& ()8715);RM<2H<R;C?2$/IKPSIS<$% 00 :$S21A2 -H-1 PJMK$%1AMS 00SISPR$C2 %% SIS?<2KF 00SIS$C %% F :$S21A2 -C2R$-S(SMSH:G8#PAIR?::#MAS2-R) J%J A:: 0F

Mainframe Refresher Part-1

VSAM-Page:1G

$%1AMS - -HP?R2 and $MP?R2 commands 2he -HP?R2 0 $MP?R2 commands can be used for 1# &ac3u! and reco"ery# 5# -*!orting a dataset; an alternate inde* or a catalog to a different (but com!atible) system# Ad"antages o"er R-PR? 1# 1atalog information is e*!orted along ith the data# 5# 1luster deletion and redefinition are not necessary during the im!ort ste! because in!ut dataset already contains catalog information# )# Also since the dataset contains catalog information it can be easily !orted to other systems# An e*!orted dataset has cross-system !ortability# &ut -HP?R2 0 $MP?R2 can be used ith VSAM datasets only and the dataset created by -HP?R2 can ha"e only a se,uential organi4ation# 2he dataset created by the -HP?R2 ste! is not !rocess-able until it has gone through a corres!onding $MP?R2 ste!# 2hus !erforming an -HP?R20$MP?R2 ta3es u! more time# Synta*: -HP?R2 entry-name ?<2/$:-(ddname) 0 ?<2%A2AS-2(dsname) o!tional !arameters -ntry-name is the name of the ob@ect that need to be e*!orted# ?<2/$:- mention e*!orted into hat name# -HP?R2 - $CH$&$2S?<R1-QC?$CH$&$2S?<R1$t s!ecifies hether the original data records (the data records of the source cluster or alternate inde*) can be accessed for any o!eration other than retrie"al after a co!y is e*!orted# 2his s!ecification can later be altered through the A:2-R command# $CH$&$2S?<R1- ($CHS) - cannot be accessed for any o!eration other than retrie"al# C?$CH$&$2S?<R1- - original data records in the original system can be accessed for any 3ind of o!eration# -HP?R2 - $CH$&$22ARJ-2($CH2)0C?$CH$&$22ARJ-2 (C$CH2) $t s!ecifies ho the data records co!ied into the target alternate inde* or cluster can be accessed after they ha"e been im!orted to another system# 2he A:2-R command is used to alter this !arameter# $CH$&$22ARJ-2 - cannot be accessed for any o!eration other than retrie"al# C?$CH$&$22ARJ-2 - 2arget ob@ect can be accessed for any ty!e of o!eration after it has been im!orted into another system# -HP?R2 - 2-MP?RARIQP-RMAC-C2 $t s!ecifies hether the cluster or alternate inde* to be e*!orted is to be deleted from the original system# 2-MP?RARI s!ecifies that the cluster or alternate inde* is not to be deleted from the original system# 2he ob@ect in the original system is mar3ed as tem!orary to indicate that another co!y e*ists and that the original co!y can be re!laced# P-RMAC-C2 s!ecifies that the cluster or alternate inde* is to be deleted from the original system# $ts storage s!ace is freed# $f its retention !eriod has not yet e*!ired; you must also code P<RJ-# P-RMAC-C2 is the default#

Mainframe Refresher Part-1

VSAM-Page:1'

-HP?R2 - -RAS-QC?-RAS2his s!ecifies hether the data com!onent of the cluster or alternate inde* to be e*!orted is to be erased or not (o"er ritten ith binary 4eros)# Aith -RAS- s!ecification; the data com!onent is o"er ritten ith binary 4eros hen the cluster or alternate inde* is deleted# Aith C?-RAS- s!ecification; the data com!onent is not o"er ritten ith binary 4eros hen the cluster or alternate inde* is deleted# -*am!le: 00-HP?R2 -H-1 PJMK$%1AMS 00%%5 %% %SCKSMSH:G8#:$&#+S%S#&A1+<P(MS); 00 %$SPK(C-A;1A2:J;%-:-2-);<C$2K2AP-; 00 V?:KS-RK151515;:A&-:K(1;S:); 00 %1&K(R-1/MK/&;:R-1:KGB) 00SIS$C %% F -HP?R2 A5BBB#:$&#+S%S#1:<S2-R ?<2/$:- (%%5) 0F $%1AMS - $MP?R2 command 2he $MP?R2 command restores the dataset from a bac3u! co!y created by the -HP?R2 command# 2he $C/$:- !arameter s!ecifies the %%CAM- that refers to the bac3u! co!y created by the -HP?R2 command# $MP?R2 $C/$:-(ddname)0 $C%A2AS-2(dsname) ?<2/$:-(ddname) 0 ?<2%A2AS-2(dsname) o!tional !arameters -

$MP?R2 - $C2?-MP2I ($-MP2I) Ahen this !arameter is s!ecified; a !re"iously e*!orted dataset can be im!orted into an em!ty !re"iously defined cluster# $f this !arameter is not s!ecified an attem!t to im!ort into an em!ty dataset ill fail# $MP?R2 - ?&9-12S Ahen the ?&9-12S !arameter is coded the attributes of the ne target dataset can be changed# 2hese attributes include V?:<M-S and +-IRACJ-S# $%1AMS-V-R$/I 1ommand $f a @ob terminates abnormally and a VSAM dataset is not closed; the catalog entry for the dataset is flagged to indicate that the dataset may be corru!t(as the end of file or last 3ey is not u!dated in the inde* !ro!erly)# $n such case you ould get VSAM status code of L'(= in the o!en of the file in the !rogram# &efore the dataset can be o!ened again; the V-R$/I command must be used to correctly identify the end of the dataset and reset the catalog entry# Alternate solution is o!en the file in /ile-aid in edit mode and @ust sa"e it# $t ould u!date the inde* ith end of file# Model synta* for the V-R$/I command: V-R$/I T/$:-(ddnameU0!ass ordV) Q %A2AS-2(entrynameU0!ass ordV)W

Mainframe Refresher Part-1

VSAM-Page:5B

&ase cluster and alternate inde* can be "erified# 2he "erification of base cluster does not "erify its alternate inde*es so each one of them must be treated se!arately# $%1AMS - A:2-R 1ommand 2he A:2-R command is used to change many of the attributes of an e*isting VSAM dataset# $t is easier doing it this ay than to delete the old dataset and to redefine it ith the ne attributes# $f the latter method is used the data ill ha"e to be bac3ed u! before deletion to !reser"e the records in it and restored after reallocation# $t is im!ortant to note that all the attributes cannot be changed ith A:2-R# /e !arameters that can=t be altered are: 1$SE; 2y!e of 1luster; $M&-%0R-P:$1A2-; R-<S-0C?R-<SSynta*: A:2-R entry-name !arameters /re,uently A:2-R is used for renaming (C-ACAM-); altering free s!ace (/R--SPA1-); tem!orarily disabling u!dates o"er dataset ($CH$&$2) and e*tend the generation limit of J%J (:$M$2)# -*am!le 91: for an AMS @ob ith comments that runs an A:2-R command

00SMSH:G81 9?& ()8715);RMuthuR;C?2$/IKPSIS<$% 00C-ACAM- -H-1 PJMK$%1AMS 00SISPR$C2 %% SIS?<2KF 00SIS$C %% F A:2-R MMB1#1<S2?M-R#MAS2-R > C-ACAM-(MMB1#1<S2MAS2) 0F 1HACJ- CAM- F0 /R--SPA1-(1B 1B) 0F 1HACJ- /R--SPA1- A::?1A2$?C F0 0F SIS$C for Adding candidate Volumes A:2-R -MP:?I--#+S%S#%A2A A%%V?:<M-S (VSAMB))

$%1AMS - M?%A: 1?MMAC%S /unctional commands are used to !erform function# Modal commands are used to test and S-2 the condition codes returned by the functional commands# :AS211 contains the return-code of the last e*ecuted functional command and if more than one functional command is e*ecuted in single $%1AMS ste!; then

Mainframe Refresher Part-1

VSAM-Page:51

MAH11 contains the ma*imum "alue of condition codes from the !re"iously e*ecuted functional commands# MAH11 is returned as ste! return code in 91:# S-2 command is used to reset the MAH11 or :AS211 ithin AMS# $/-2H-C--:S- statements are used to control the command e*ecution se,uence# $n the belo e*am!le; R-PR? command loads data from a se,uential dataset on to a +S%S# ?nly if the condition code of the R-PR? ste! is 4ero; the ne*t :$S21A2 ste! ill be e*ecuted# ?ther ise the +S%S ill be deleted# MAH11 is set to 4ero at the end to a"oid non-4ero return code# 00SIS$C %% F R-PR? $C%A2AS-2(SMSH:G8#%A2A#2-S2) ?<2%A2AS-2(SMSH:G8#2-S2#+S%S) $/ :AS211 K B 2H-C :$S21A2 -C2R$-S(SMSH:G8#2-S2#+S%S) A:: -:S%-:-2- SMSH:G8#2-S2#+S%S -C%-$/ S-2 MAH11KB 0F $1AMS ste! Return codes and meaning -rror 1ode B 6 G 15 18 Se"erity of -rror Co -rror Minor -rror Ma@or -rror :ogical -rror Se"ere -rror Meaning /unctional command com!leted its !rocessing successfully Processing is able to continue; but a minor error occurred; causing a arming message to be issued Processing is able to continue; but a more se"ere error occurred; causing ma@or command s!ecifications to be by!assed Jenerally; inconsistent !arameters are s!ecified; causing the entire command to be by!assed An error of such se"erity occurred that not only can the command causing the error not be com!leted; the entire AMS command stream is flushed

A:2-RCA2- $C%-H Ceed for A$H

Mainframe Refresher Part-1

VSAM-Page:55

1# +S%S dataset is currently accessed using a !rimary 3ey# Ae the dataset RAC%?M:I ith another 3ey# 5# Ae ant to access -S%S file RAC%?M:I based on 3ey# Ste!s $n"ol"ed

ant to access

Ste!1# %efine A$H# %-/$C- A:2-RCA2-$C%-H command defines an alternate inde*# $m!ortant !arameters of this command are: Parameter R-:A2C?C<C$.<-0 <C$.<+-IS <PJRA%R-1?R%S$EMeaning Relates A$H ith base cluster %u!licates are allo ed 0 not allo ed in alternate 3ey# %efines the length and offset of alternate 3ey in base cluster Adds the A$H cluster to the u!grade set of base cluster# Ahene"er base is modified; its u!grade set is also modified# <PJRA%- is default# C?<PJRA%- didn=t add the A$H to base cluster u!grade set# S!ecifies the record si4e of alternate inde* record# $t is calculated using the formula in the ne*t table#

A$H Record Si4e 1alculation: <C$.<- Alternate +ey +S%S -S%S 7MAlternate +ey length MPrimary +ey :ength 7MAlternate +ey length MR&A si4e (R&A si4e K 6 bytes) C?C<C$.<- Alternate +ey ma*imum n du!licates 7MAlternate +ey length M(n F Primary +ey :ength) 7MAlternate +ey length M(n F R&A si4e ) (R&A si4e K 6 bytes) ith

/i"e &yte control information of Alternate $nde* Record: &yte-1 &yte-5 &yte-) &yte-6 &yte-7 2y!e of 1lusterX H=BB= indicates -S%S and H=B1= indicates +S%S# :ength of base cluster !ointers in alternate inde*X Primary 3ey length for +S%S and H=B6= for -S%S# Half ord binary indicates number of occurrences of !rimary 3ey !ointers in alternate inde* record# H=BBB1= for uni,ue alternate 3ey# :ength of alternate 3ey#

Ste!5# &:%$C%-H Alternate inde* should ha"e all the alternate 3eys ith their corres!onding !rimary 3ey !ointers# After the A$H is defined; this information should be loaded from base cluster# 2hen only e can access the records using A$H# &:%$C%-H do this :?A% o!eration#

Mainframe Refresher Part-1

VSAM-Page:5)

$m!ortant !arameters of this command are: 1# $C/$:- and ?<2/$:- !oints to &ase 1luster and Alternate inde* 1luster# 5# $C2-RCA:S?R2; -H2-RCA:S?R2; A?R+/$:-S: :oaded A$H should ha"e sorted alternate record 3eys ith base cluster 3eys# So an intermediate S?R2 is re,uired in bet een reading the base cluster and loading the A$H# Ae should allocate or3 datasets $%1<21 and $%1<25 for this S?R2# $f $C2-RCA:S?R2 !arameter is coded; then AMS tried to do internal sort if enough memory is a"ailable and it ould be fast# $f enough s!ace is not a"ailable; then if you ha"e coded $%1<21 and $%1<25; it uses that s!ace and does an e*ternal sort# $f you code -H2-RCA:S?R2 !arameter; then AMS ont try for internal sort# $f you ant to gi"e your o n %%CAM- files for sorting instead $%1<21 and $%1<25; inform it to AMS by A?R+/$:-(%%CAM-1; %%CAM-5) !arameter# Here; %%CAM-1 and %%CAM-5 are allocated instead of $%1<21 and $%1<25# Ste!)# %efine Path 2he %-/$C- PA2H command establishes a bridge bet een the base cluster and an alternate inde*# $t does not occu!y any s!ace# $t is @ust a catalog entry; hich establishes a lin3 bet een an alternate inde* and a base cluster# $m!ortant !arameters of this command are: 1# PA2H-C2RI command relates PA2H ith A$H# 5# Ahen you o!en a PA2H; res!ecti"e base cluster ill automatically be o!ened# <P%A2- o!ens the <PJRA%- set of the base cluster also and it is default# C?<P%A2- o!ens only the base cluster and not its the <PJRA%- set# $n &A21H; if you ant to access base cluster ith alternate 3ey; you should allocate the PA2H in the 91:# 2he name of the %%CAM- for the PA2H in 91: is %%CAM- of the base cluster suffi*ed ith 1 for first alternate 3ey and n for nth alternate 3ey# Refer the 1?&?: material for more information# $n 1$1S; if you ant access base cluster ith alternate 3ey; then you should register the PA2H as /12 entry#

-*am!le: 1#1ommand that defines an alternate inde* %-/$C- A$H ( CAM-(MMA5#-MPMAS2#SSC#A$H) -

Mainframe Refresher Part-1

VSAM-Page:56

R-:A2-(MMA5#-MPMAS2) +-IS(' 15) <C$.<-+-I <PJRA%R-<SV?:<M-S(MPSGBB) ) %A2A ( CAM-(MMA5#-MPMAS2#SSC#A$H#%A2A) 1I:$C%-RS(1 1) ) $C%-H ( CAM-(MMA5#-MPMAS2#SSC#A$H#$C%-H) )

5#1ommand that defines PA2H %-/$C- PA2H ( CAM-(MMA5#-MPMAS2#SSC#PA2H) PA2H-C2RI(MMA5#-MPMAS2#SSC#A$H) <P%A2- ) )#A @ob that builds an alternate inde* 00MMB1:1) 9?& ()8715);RM<2H<R;C?2$/IKPSIS<$% 00&:%$C%H -H-1 PJMK$%1AMS 00SISPR$C2 %% SIS?<2KF 00$%1<21 %% <C$2KSIS%A;V?:KS-RKMPSGBB;%$SPK?:% 00$%1<25 %% <C$2KSIS%A;V?:KS-RKMPSGBB;%$SPK?:% 00SIS$C %% F &:%$C%-H $C%A2AS-2(MMA5#-MPMAS2) ?<2%A2AS-2(MMA5#-MPMAS2#SSC#A$H) 1A2A:?J(MMA5) 0F 2he order of build inde* and definition of PA2H does not matter#

AMP Parameter in 91: 2he Access Method Parameter (AMP) com!letes information in an Access method 1ontrol &loc3 (A1&) for a VSAM data set# 2he A1& can be coded for a 3ey-se,uenced (+S%S); entry-se,uenced (-S%S); or relati"e record (RR%S) VSAM data set# AMP is only su!!orted for VSAM data sets#

Mainframe Refresher Part-1

VSAM-Page:57

AMP is most often used to allocate $0? buffers for the inde* and data com!onents for o!timi4ing !erformance# Synta*: AMPK(sub !arameter; sub !arameter;) or AMPK(Rsub !arameter; sub !arameter;R) Single a!ostro!hes are re,uired if the sub !arameter(s) contain s!ecial characters# AM?RJ 2his !arameter; hich stands for Access Method ?RJani4ation; indicates that the !articular %% statement refers to a VSAM dataset# &</C% 2his !arameter gi"es the number of $0? buffers needed for the data com!onent of the cluster# 2he si4e of each buffer is the si4e of the data 1$# 2he default "alue is t o data buffers one of hich is used only during 1$01A s!lits# 2herefore the number of data buffers left for normal !rocessing is one# $f more data buffers are allocated; then !erformance of se,uential !rocessing ill im!ro"e significantly# &</C$ 2his !arameter gi"es the number of $0? buffers needed for the inde* com!onent of the cluster# -ach buffer is the si4e of the inde*# 2his sub-!arameter may be coded only for a +S%S because -S%S and RR%S do not ha"e inde* com!onents# 2he default "alue is one inde* buffer# $f more inde* buffers are allocated; then !erformance of random !rocessing ill im!ro"e significantly# &</SP 2his !arameter indicates the number of bytes for data and inde* com!onent buffers# $f this "alue is more than the "alue gi"en in the &<//-RSPA1- !arameter of the %-/$C- 1:<S2-R; it o"errides the &<//-RSPA1-# ?ther ise &<//-RSPA1- ta3es !recedence# 2he "alue of &</SP is calculated as &</SP K %A2A 1$S$E- * &</C% M $C%-H 1$S$E- * &</C$ Ho e"er it is recommended not to code this !arameter and let VSAM !erform the calculations from the &</C% and &</C$ "alues instead# ?ther !arameters are 2RA1-; S2RC?; R-1/M; ?P21%; 1R?PS#

$f SMS is acti"e; then VSAM datasets can be created in 91: belo :

ithout using $%1AMS as

00+S%S/$:- %% %SCK%-V$#1<S2#MAS2-R;%$SPK(C-A;1A2:J;%-:-2-); 00 SPA1-K(1I:;(1B;1B));

Mainframe Refresher Part-1

VSAM-Page:58

00

:R-1:K1BB;+-I?//K1B;+-I:-CK15;R-1?RJK+S

R-1?RJ can also be -S(for -ntry Se,uenced %atasets); RR(for Relati"e Record datasets) and :S(for :inear %atasets)# ?ther !arameters of %-/$C- 1:<S2-R ill be assigned default "alues or you can additionally mention SMS !arameter; %A2A1:ASS that is defined ith !redefined "alues# $C2-RV$-A .uestions 1# 1ontrol inter"al and 1ontrol Ares S!lit# FFFFF 5# Ceed for alternate inde*# Ste!s in"ol"ed in creating alternate inde*# FFFFF )# -*!lain the need of PA2H# FFFF 6# $m!ortance of <PJRA%- and <P%A2-# FFF 7# /ile Status > 51 55 5) 56 B5 'B '5 FFFFF 8# Ho do e read +S%S using A$H in batch 1?&?: and 1$1SD FFFF (# Alternate record si4e calculation# FFF G# %ifference bet een %-:-2- P<RJ- -RAS- /?R1FF '# <nderstanding of +-IS !arameter# $f the 3ey is from 1Bth byte to 1)th byte; ho ill you code +-IS !arameterD FFF 1B# $M&-% and R-P:$1A2- o!tions %-/$C- 1:<S2-RD FFF 11# SP--%0 R-1?V-RI of %-/$C- 1:<S2-RD FF 15# R-<S- o!tion of %-/$C- 1:<S2-RD FF 1)# R-P:A1- o!tion of R-PR?D FF 16# Selecti"e co!y o!tions of R-PR? FF 17# Ho to rename a set of files in one shotD FF 18# Ho do you choose control inter"al and control area si4e for your a!!licationD FFFFF 1(# Ho to access -S%S randomly in batch 1?&?:D FFF 1G# Ahat is s3i!-se,uential R-A% and ho batch 1?&?: su!!orts itD FF 1'# Share o!tions of %-/$C- 1:<S2-R FF 5B# /amiliarity ith /$:-A$% for VSAM o!erations# FF 51# /SP1 and its im!ortance# /SP1(B B); /SP1(1BB 1BB) meaning# FF 55# Ho do you chec3 ho many records are there in the VSAM cluster and the /SP1 a"ailability for future insertionD FF 5)# Ahat is VSAM reorgani4ation and ho fre,uently e need to do thatD FF 56# After the VSAM is created; first o!eration e should do is; initiali4ing it ith dummy record# 2rue0 /alse# $f $ am not initiali4ing; hat o!eration ould gi"e me !roblemD FF 57# Ad"antages of VSAM o"er other access methods# FF 58# VSAM to %&5 con"ersion strategy FF 5(# Ho do you choose &</C$; &</C% !arameters for better !erformanceD FF 5G# 1an $ un-catalog or delete a dataset using %$SP !arameter of 91:D FF 5'# Ahat is the :$S21A2 le"el !arameter ill doD FF )B# VSAM dataset is allocated ith %$SPKSHR o!tion in a 91: ste!# %oes it mean that the !rogram access the file in R-A% only modeD FFF )1# Ahat are the ays you can get the attributes of VSAM file hen you don=t ha"e VSAM %-/$C- card ith youD FF )5#Ahat are different ty!es of VSAM their !ro!erties# 2here may be lot of ,uestions in the !ro!erties li3e can $ delete -S%S record; 1an $ ha"e A$H for RR%S etc# So read the !ro!erties table and understand thoroughly# FF

Mainframe Refresher Part-1

VSAM-Page:5(

C?2-S

Mainframe Refresher Part-1

VSAM-Page:5G

C?2-S

S-ar putea să vă placă și