Associating a VSAM Data Source With a Master File

How to:

You can associate a VSAM file with a Master File using the following methods:


Top of page

x
Syntax: How to Specify a Physical File Location for the VSAM Data Source

The DATASET attribute is used at the file declaration level of the Master File. The syntax is

{DATASET|DATA}='filename'

where:

filename

Is the platform-dependent physical name of the data source.

Note: If a DATASET allocation is in effect, a CHECK FILE command must be issued in order to override it by an explicit allocation command. The CHECK FILE command will deallocate the allocation created by DATASET.



Example: Allocating a VSAM Data Source Using the DATASET Attribute

The following example illustrates how to allocate a VSAM data source on the file declaration level and for an alternate index:

FILE=EXERVSM1, SUFFIX=VSAM, DATASET='VSAM1.CLUSTER1',$
SEGNAME=ROOT , SEGTYPE=S0,$
 GROUP=KEY1  , ALIAS=KEY , FORMAT=A4, ACTUAL=A4 ,$
  FIELD=FLD1 , ALIAS=F1  , FORMAT=A4, ACTUAL=A4 ,$
  FIELD=FLD2 , ALIAS=F2  , FORMAT=A4, ACTUAL=A4 ,$
  FIELD=FLD3 , ALIAS=DD1 , FORMAT=A4, ACTUAL=A4 , FIELDTYPE = I ,
        DATASET='VSAM1.INDEX1' ,$
  FIELD=FLD4 , ALIAS=F4  , FORMAT=A4, ACTUAL=A4 ,$
  FIELD=FLD5 , ALIAS=F5  , FORMAT=A4, ACTUAL=A4 ,$
  FIELD=FLD6 , ALIAS=F6  , FORMAT=A4, ACTUAL=A4 ,$
  FIELD=FLD7 , ALIAS=F7  , FORMAT=A4, ACTUAL=A4 ,$


Example: Overriding DATASET With a FILEDEF Command

You can override the DATASET value in the Master File with a FILEDEF command. The FILEDEF can be done locally within a procedure (before accessing the file) or within the profile. For example,

FILEDEF vsamfile DISK filename

where:

vsamfile

Is the logical metadata reference name matching the physical file name.

filename

Is the OpenVMS file name. It may be any valid OpenVMS file specification or logical name pointing to a file.


Top of page

x
Syntax: How to Specify the Location of VSAM Files Manually

VSAM data sets may be allocated with JCL

//QAVSM DD DISP=SHR, DSN=cluster_name

or with DYNAM

DYNAM ALLOC FILE QAVSM DA cluster_name SHR REUSE

or in a Master File as

DATASET='dataset_name,' $

where:

cluster_name

Is the name of the VSAM cluster.

dataset_name

Is the name of the data set on MVS.

Note that if you are using an alternate index (an additional, separate index structure that enables you to access records in a VSAM data source based on a key other than the primary key for that data source), the alternate index must be associated with the base cluster it describes by a path that is stored in a separate data source, see Using VSAM Relative Record Data Set (RRDS) Files. In addition to defining the location of the base cluster, you must define the path clusters either in IRUNJCL or using a DYNAM command. For details about logical processing with alternate indexes, see Reporting From Files With Alternate Indexes.

Note: The Adapter for VSAM supports full read/write access.



Example: Defining Path Clusters in JCL
//VSAMFL1  DD DISP=OLD,DSN=EDABXV.VSAM.AXINDEX1.PATH
//VSAMFL2  DD DISP=OLD,DSN=EDABXV.VSAM.AXINDEX2.PATH

iWay Software