Associating an RMS Data Source to a Master File

In this section:

How to:

You can associate an RMS file to a Master File using the following methods:

If both attributes exist, DATASET takes precedence over RMSFILE. However, an explicit FILEDEF command takes precedence over both the DATASET and RMSFILE attributes.


Top of page

x
Syntax: How to Specify a Physical File Location for the RMS 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 an RMS Data Source Using the DATASET Attribute

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

FILE=EXERVSM1, SUFFIX=RMS,$
DATASET='MYDISK:[mydata.sample]testdata.dat',$
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 ,$
  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 ,$

Top of page

x
Syntax: How to Associate an RMS Data Source in an Access File

The Access File has the following format

RMSFILE   = filename,
[ACCESS   = {SHARED|READONLY},]
[LOCKMODE = {SKIP|KEEP} ,]
[STATMODE = {EXCEPTIONS|ON|OFF},] $

where:

filename

Is one of the following:

  • A fully qualified file name, including files on remote hosts.
  • A logical that points to a local or fully qualified RMS file.


Example: Overriding DATASET and RMSFILE With a FILEDEF Command

You can override the DATASET value in the Master File or the RMSFILE declaration in the Access 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 rmsfile DISK filename

where:

rmsfile

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
When to Use an Access File With an RMS Data Source

An Access File is optional for an RMS data source if the DATASET attribute is used in the Master File and if WRITE access is not required. However, even in those instances, you may wish to have an Access File to specify ACCESS, LOCKMODE, and STATMODE for RMS files:

See File and Record Locking for more information on ACCESS, LOCKMODE, and STATMODE. For related information, see Handling Locked Records During Table Read Request.


Top of page

x
File and Record Locking

This topic describes features that enable a developer to control file and record locking. Lock conflict, or contention, can occur at file level or record level. File contention is caused by incompatible access by two or more processes. Record contention is caused when a requested lock is incompatible with any existing locks on the record.

The following terms summarize the types of access allowed to RMS files and records:

Access Type

Description

Read Access

Provides users with access to a file and the records in the file for actions that make no alterations. Read can use any access mode (dependent on site needs) for the actions that are defined in the following tables.

Read/Write Access

Provides users with access to a file and the records in the file for actions that make alterations to records, add records, or delete records. Read/write access requires the use of SHARED as the access mode. All other modes are not supported WRITE operations.


Top of page

x
File Locking and the Interface to RMS

When your request attempts to open an RMS file, the Access Parameter within the Access File determines what you can do at a file level with the RMS file, and what actions others can take while you have the file open.

When a request attempts to open an RMS file, the Access Parameter determines which type of access to use. If the Access Parameter specification is incompatible with another process' access to the file, the procedure fails because it is not able to open the file. Additionally, if the file is opened for read, but a subsequent write is attempted, it will fail due to an inappropriate access mode.

Depending on how a file is opened, as specified by the Access Parameter, subsequent opens are limited as follows:

 

Processes by Others

READONLY

SHARED

PROTECTED

EXCLUSIVE

Processes by Server Users

READONLY

Allowed

Allowed

Allowed

Denied

SHARED

Allowed

Allowed

Allowed when SHAREd process is doing read-access operation.

Denied

This table describes user access and file sharing options used in response to the following Access File options for the Access Parameter.

Access Parameter

User Access

File Sharing to Other Processes

READONLY

Read

Read and Write

SHARED

Read and Write

Read and Write


Top of page

x
Record Locking

RMS requests are no-lock for each record retrieved for READ operations.


Top of page

x
Handling Locked Records During Table Read Request

In this section:

RMS files can be accessed while they are simultaneously accessed by other programs. For instance, the file might be in use by another program that is maintaining it by adding, deleting, or updating records.

When a READ operation is rejected due to a lock conflict by another process, the request is aborted and the following message is displayed:

(FOC1325) RMS READ LOCK ABORT ERROR

You can override this behavior on a file-by-file basis using the LOCKMODE and STATMODE options in the Access File. LOCKMODE and STATMODE do not apply to WRITE requests such as UPDATE or DELETE.



x
LOCKMODE

LOCKMODE can affect record retrieval in one of two ways. Each of these settings and the affect they have on the retrieval process is as follows:



x
STATMODE

STATMODE controls whether or not a message is sent to the client program about retrieved records. STATMODE has three settings:



Example: Sample Uses for an Access File

The following is an example of a Remote Node:

RMSFILE=HOST1::DISK$PROG:[PROD.INFO]EMPINFO.DAT,ACCESS=SHARED,$

The following is an example of a Full Path as defined by a logical and a file name:

RMSFILE=DATADIR:PERSON.DAT,ACCESS=READONLY,$

The following is an example of a Logical Name:

RMSFILE=MYLOGICAL,ACCESS=SHARED,$

The following is an example of a Full Path on a file using LOCKMODE and STATMODE:

RMSFILE=DISK100:[DATA]PERSON.DAT,ACCESS=READONLY,LOCKMODE=SKIP,
  STATMODE=OFF,$

iWay Software