The following statements and commands refer only to the options allowed for RMS indexed files. For more general information on any ACCENT R statements or commands, refer to the Reference Manual.
PURPOSE: The FORM statement allows you to choose the mode of storage for records in the Data Set associated with the Schema Definition. This statement is required for RMS indexed files.
FORM /IS/ RMS INDEXED
where:
RMS INDEXED defines the mode of storage for an RMS indexed file. This is the only acceptable form for RMS indexed files.
For integer, numeric, date and full date data, the data types are stored in binary form by default. The BINARY default can be overridden by using the field statement clause USAGE /IS/ ASCII.
In this example, a Schema Definition called PHONE is defined for a simple application which creates a phone list.
*DEFINE SD PHONE
--10 FORM IS RMS INDEXED
--20 NAME, C, 10
--30 EMP.NO, I, 9
--40 PHONE.NO, I, 10
--SAVE
PURPOSE: The CREATE DS command creates a Data Set and associates it with a Schema Definition. The command can be used to enter the data set name into the DBL so you can create a new data set or establish an existing file as a Data Set.
Either the ATTACH or ENTRY /ONLY/ clause must be specified for RMS indexed files.
CREATE DS name SD /IS/ sd.name
[ENTRY /ONLY/ ;ATTACH]
where: name assigns a name to the Data Set.
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.
ENTRY /ONLY/ enters the DS name into the DBL. This creates the Data Set without creating the file or checking to see if the file exists.
ATTACH specifies that the file already exists.
- WARNING -
If you want to remove the DS without deleting the RMS indexed file, use the REMOVE ENTRY FOR DI di.name command and then the REMOVE ENTRY FOR DS ds.name command. This removes the entry from the DBL, but leaves your file intact.
In this example, a Data Set called PHONE.RMS is created, and ACCENT R is informed not to check for the file or create it with the ENTRY ONLY clause.
*CREATE DS PHONE.RMS SD PHONE ENTRY ONLY
PURPOSE: An Index Definition (ID) defines a general index for a Schema Definition, which can then be used to create Data Indexes for any Data Set associated with the specified Schema Definition.
When defining ID's for RMS indexed files, the use of some statements changes. You must define the Index Definition type as RMS by specifying the statement INDEX TYPE IS RMS, and associating it with an SD.
GENERAL FORM: General Statements
INDEX TYPE /IS/ RMS
INDEX TO SD sd.name
where:
INDEX TYPE /IS/ RMS |
associates an RMS indexed storage form with this Index Definition. |
INDEX TO SD sd.name |
associates the Index Definition with a Schema Definition. |
sd.name |
is the name of the Schema Definition associated with this Index Definition. For information and an example of relating multiple DI's to an ID, refer to section 3 of the ACCENT R Reference Manual. |
GENERAL FORM: Specific Statements for Each Domain
DOMAIN name ON \\fields\\
[DUPLICATES [NOT] ALLOWED]
[KEY CHANGE [NOT] ALLOWED]
where:
DOMAIN name ON \\fields\\ |
names the domain and specifies the key fields. |
DUPLICATES [NOT] ALLOWED |
controls whether more than one record in the Data Set is allowed to have the same key field value. The default is DUPLICATES ALLOWED. |
KEY CHANGE [NOT] ALLOWED |
the first domain for an RMS indexed file must specify KEY CHANGE NOT ALLOWED since the first key is the primary key. This statement is not required on the other domains. |
The following example illustrates the ID definition called PHONE.RMS for an RMS index.
*DEFINE ID PHONE.RMS ENTRY ONLY
--10 INDEX TYPE IS RMS
--20 INDEX TO SD PHONE
--30 DOMAIN NAME ON NAME
--40 KEY CHANGE NOT ALLOWED
--SAVE
PURPOSE: You must define a DI with the DEFINE DI command for an RMS indexed file. This command puts you at the edit level where you can define all domains of the Data Index or refer to an Index Definition containing the domains for the Data Index.
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.
Either the ATTACH or ENTRY /ONLY/ clause must be used for RMS indexed files.
DEFINE DI name
(ATTACH;ENTRY /ONLY/)
where:
ATTACH |
specifies that the file already exists. |
ENTRY /ONLY/ |
defines the DI without creating the file or checking to see if the file exists. |
This example creates a Data Index called PHONE.RMS that is associated with the Data Set PHONE.RMS ACCENT R is informed not to check for the file or create it with the ENTRY ONLY clause.
*DEFINE DI PHONE.RMS ENTRY ONLY
- WARNING -
The DI or ID description must match the key fields in the RMS indexed file. When modifying DI's you must use the ENTRY ONLY option or ACCENT R will clear the file, and you will lose your data.
To remove the DI without deleting the RMS indexed file, use REMOVE ENTRY FOR DI di.name. This only removes the DI entry from the DBL and leaves the file intact.