The RMS interface lets you access standard OpenVMS RMS (Record Management Services) files from ACCENT R.
This section is divided in two parts. The first part shows how to access these RMS file types from ACCENT R:
Sequential undefined (fixed length)
The second part of this section shows how to access RMS indexed files.
If you need to use an RMS file, determine if the file will be used within ACCENT R only, or if it will also be used by applications outside of ACCENT R. Then, use the table below to determine the FORM statement to use in the SD.
File access from ... |
FORM IS ... |
Equivalent RMS File Type |
ACCENT R applications only |
COMPRESSED |
Sequential undefined (variable length) |
|
ASCII |
Sequential undefined (fixed length) |
ACCENT R and non-ACCENT R applications |
BINARY ASCII NOCR LINED |
Binary sequential fixed ASCII sequential fixed Sequential variable |
If you are using an existing RMS sequential file and it will be accessed from both ACCENT R and outside of ACCENT R use the second part of the table.
Determine what type of RMS file it is. Use the DCL command $DIR/FULL (file.name). The $DIR/FULL command tells you the RMS organization (sequential variable, sequential fixed), carriage control, and record layout.
Once you know the RMS file type, find that type under the heading "Equivalent RMS File Type" in the table above to determine the type of ACCENT R SD to define. For example, if you have an RMS sequential variable file, you need to define a FORM IS LINED data set.
If you do not know if your RMS file is binary or ASCII, type out the file. If the typed file looks like meaningless data, it is probably binary.
If you have an RMS file that will not be used outside of ACCENT R you can CONVERT it to one of ACCENT R's "native" file types (FORM IS COMPRESSED or FORM IS ASCII). ACCENT R's native file types provide faster access than RMS because of queued input/output (QIO).
RMS pads records with uneven byte counts, so you may need to add a FILLER field to make the record in the SD an even number of bytes for sequential fixed length RMS file types.
ACCENT R supports OpenVMS RMS indexed files. You can use ACCENT R with existing RMS indexed files without reformatting your data into ACCENT R's internal structure.
If you don't need the native RMS indexed file structure, you can convert your files into ACCENT R's RAM index structure using ACCENT R's CONVERT command. After converting, you will need to define a data index.
RMS has a few inherent restrictions which do not apply to ACCENT R's native file types. These are summarized below. Once you have declared your RMS data set (DS) and data index (DI) file for use, most of the capabilities and functions available in ACCENT R can be used.
In RMS indexed files, both the data and the index are in the same file and both use the same file name. For this reason, the same name must be used for the Data Index and the Data Set. You must also specify the same file extension for the Data Index and the Data Set.
The first domain is considered the primary key. Only one key field can be specified as the primary key. Primary key values cannot be changed.
RMS indexed files allow up to eight fields which can be specified for a domain. Multiple key fields must be of ASCII character type only.
You cannot use the FIND command and FIND subsets with RMS indexed files (FIND, KEEP, RESTORE, and EVALUATE commands).
RMS indexed files are always in Simultaneous Update mode. Control files are not necessary for RMS indexed files, and their definition is not allowed. However, record level queuing, not block level queuing, is used.
Multiple record types are not supported.
You cannot do a CLEAR DS command for an RMS indexed file, an EXTRACT TO an RMS indexed file, or a CONVERT TO an RMS indexed file. These functions do not go through an index, but with RMS indexed files, you must always go through an index.
You cannot do a FORM DI for an RMS indexed file.
The SORT command cannot be used with an RMS indexed file.
GET statements can only retrieve from an RMS indexed file in a forward direction. GET LAST, GET PRIOR, GET LOW... FIT, GET LAST... FIT, GET PRIOR... MATCH BY, and GET LAST... MATCH BY cannot be used.
First define the Schema Definition, then create the Data Set, and finally define a Data Index or Index Definition. Follow the same steps used to define these items for native ACCENT R files, as described below. In this procedure, a simple application which creates a phone list is used to illustrate the steps to define an RMS indexed file.
Create or declare a DBL for your application.
*USE DBL EXAMPLES
Define a Schema Definition with the DEFINE SD command. The first Schema definition statement must be FORM IS RMS INDEXED. With this FORM statement, the data types default to the same form as defined by FORM IS BINARY.
*DEFINE SD PHONE
--10 FORM IS RMS INDEXED
--20 NAME, C, 10
--30 EMP.NO, I 9
--40 PHONE.NO, C, 10
--SAVE
Since it is common to have ASCII data, you may need to specify USAGE [IS] ASCII for some fields.
Create the Data Set with the CREATE DS command. Use the ATTACH option to specify that the RMS indexed file already exists or the ENTRY ONLY option to enter the DS name into the DBL without creating the file itself. You cannot use the KEYED ON field option to automatically create the RMS indexed files.
*CREATE DS PHONE.RMS SD PHONE ENTRY ONLY
Define the Data Index, using the DEFINE DI command with the ATTACH or ENTRY ONLY option. You must define the index type as RMS by using the statement INDEX TYPE IS RMS. Associate the data index with the data set by using the INDEX TO DS statement.
*DEFINE DI PHONE.RMS ENTRY ONLY
or
*DEFINE DI PHONE.RMS ATTACH (If file already exists)
--10 INDEX TYPE IS RMS
--20 INDEX TO DS PHONE.RMS
In RMS indexed files, both the data and the index are in the same file and both use the same file name. For this reason, the same name must be used for the Data Index and the Data Set. You must also specify the same file extension for the Data Index and the Data Set, because ACCENT R automatically assigns DS as an extension to the Data Set name and DI as an extension to a Data Index name if an extension is not specified. This results in two separate files being created in ACCENT R.
- WARNING -
The DI description must match the key fields in the RMS indexed file. When modifying a DI for an RMS indexed file, you must use the ENTRY ONLY option as shown in the example below.
*MODIFY DI di.name ENTRY ONLY
Specify the domains in the Data Index. The primary key in the RMS indexed file must be specified as the first domain. Since changes to the primary key field values are not allowed, you must specify KEY CHANGE NOT ALLOWED. The alternate keys in the RMS indexed file are specified as the other domains. All of the alternate keys must be specified as domains.
Only certain field types are allowed as key fields by RMS. These are Alpha (A), Character (C), Binary Integer (I), Binary Date (D), and Binary Full Date (F). Numeric fields are not allowed. If you specify multiple fields, the fields must be ASCII Character type only. The maximum number of fields allowed in a multiple-field key is eight.
*DEFINE DI PHONE.RMS ENTRY ONLY
--10 INDEX TYPE IS RMS
--20 INDEX TO DS PHONE.RMS
--30 DOMAIN NAME ON NAME
--40 KEY CHANGE NOT ALLOWED RMS required statement
--45 1 for primary key field only
--50 DOMAIN EMPNO ON EMP.NO
--60 DOMAIN PHONE ON PHONE.NO
--SAVE
Open the RMS data/index file for data manipulation. With RMS, the USE DI statement must always follow or be combined with the USE DS statement.
*USE DS PHONE.RMS ALWAYS DI PHONE.RMS
*ENTER NEW WITH PROMPTS
NAME: JEROME
EMP.NO 123
PHONE.NO 4082577700
NAME: ***
*EXTRACT
JEROME 123 4082577700
NOTE: You must use ALWAYS in the USE DS command if the file does not currently exist. Otherwise, ACCENT R will report it as missing. You must also use NEW in the ENTER command if the file does not yet exist. Otherwise, ACCENT R assumes the file is there and attempts to append to it.