In this section:
How to: |
You can associate an RMS file to 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 or RMSFILE values. This allocation is stored temporarily and is released when a new Master File is used or when the session terminates.
If both attributes exist, DATASET takes precedence over RMSFILE. However, an explicit FILEDEF command takes precedence over both the DATASET and RMSFILE attributes.
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 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 ,$
The Access File has the following format
RMSFILE = filename, [ACCESS = {SHARED|READONLY},] [LOCKMODE = {SKIP|KEEP} ,] [STATMODE = {EXCEPTIONS|ON|OFF},] $
where:
Is one of the following:
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:
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.
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.
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. |
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 |
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.
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:
To halt retrieval when locked records are encountered, omit LOCKMODE from the acx file. A (FOC1325) RMS READ LOCK ABORT ERROR will be sent if locked records are encountered during record retrieval. Records retrieved before the lock is encountered may have already been sent to the client and should be discarded.
LOCKMODE = KEEP
LOCKMODE = SKIP
STATMODE controls whether or not a message is sent to the client program about retrieved records. STATMODE has three settings:
To receive a message giving the statistics of data retrieval, set STATMODE to ON in the Access File. The message displays, in addition to the report request, after data retrieval is complete. For example:
STATMODE = ON
A FOC1320 message displays when no locked records are encountered. For example:
(FOC1320) RMS STATS :(SEGCAR ) Reads = 1, Skips = 0, Keeps = 0
If LOCKMODE is set to KEEP a FOC1324 message displays. For example:
(FOC1324) RMS KEEP :(SEGCAR ) Reads = 1, Skips = 2, Keeps = 0
If LOCKMODE is set to SKIP, a FOC1322 message displays. For example:
(FOC1322) RMS SKIP :(SEGCAR ) Reads = 1, Skips = 0, Keeps = 2
Set the STATMODE to OFF if no messages are to be sent when locked records are encountered. The client application will not have any indication whether or not locked records were encountered during record retrieval.
To receive a message giving the statistics of data retrieval, only if locked records are encountered, set the STATMODE to EXCEPTIONS. The message displays, in addition to the report request, after data retrieval is complete. No message displays if no locked records are encountered during retrieval. For example:
STATMODE = EXCEPTIONS
If LOCKMODE is set to KEEP a FOC1324 message displays. For example:
(FOC1324) RMS KEEP :(SEGCAR ) Reads = 1, Skips = 2, Keeps = 0
If LOCKMODE is set to SKIP, in addition to the report output, a FOC1322 message displays. For example:
(FOC1322) RMS SKIP :(SEGCAR ) Reads = 1, Skips = 0, Keeps = 2
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,$
WebFOCUS |