How to: |
You can associate a VSAM file with a Master File using the following methods:
If the data file name is not allocated, an internal command is issued to perform the allocation using the DATASET value. This allocation is stored temporarily and is released when a new Master File is used or when the session terminates.
The DATASET attribute is used at the file declaration level of the Master File. The syntax is
{DATASET|DATA}='filename'
where:
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.
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 ,$
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:
Is the logical metadata reference name matching the physical file name.
Is the OpenVMS file name. It may be any valid OpenVMS file specification or logical name pointing to a file.
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:
Is the name of the VSAM cluster.
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.
//VSAMFL1 DD DISP=OLD,DSN=EDABXV.VSAM.AXINDEX1.PATH //VSAMFL2 DD DISP=OLD,DSN=EDABXV.VSAM.AXINDEX2.PATH
iWay Software |