Creates an RMS sequential or indexed sequential data file for the DEC DATATRIEVE RMS domain specified by the dictionary path name. Format for Defining a Sequential File DEFINE FILE [FOR] path-name [ ALLOCATION = n ] [ SUPERSEDE ] [,...] [ MAX ] [ ] Format for Defining an Indexed File DEFINE FILE [FOR] path-name [ ALLOCATION = n ] [ SUPERSEDE ] [,...] [ MAX ] [ ] { KEY = field-name-1 [ ( [NO]CHANGE[,] [NO]DUP) ] } [,...] Format for Defining an RMS File Using a FDL File DEFINE FILE [FOR] domain-name USING fdl-file-spec
1 – Arguments
path-name Is the dictionary path name of the DEC DATATRIEVE domain based on a RMS file for which you want to create a data file. domain-name Is the name of the DEC DATATRIEVE domain for which you want to create a data file. ALLOCATION = n Specifies an unsigned nonzero integer that determines the number of disk blocks initially allocated for the data file. If you omit this argument, zero blocks are allocated for the file. When you store records into the data file, RMS automatically extends the data file according to the cluster size established by your system manager. SUPERSEDE Causes DEC DATATRIEVE to delete any existing data file that exactly matches the complete file specification, including the version number, in your RMS domain definition. The new file you are defining replaces the existing data file. If your domain based on a RMS file does not include a file version number, the old file is not deleted, and the new file is assigned the next higher version number. MAX Causes DEC DATATRIEVE to create a fixed-length RMS file for a domain whose record definition contains an OCCURS . . . DEPENDING clause. The length of every record in the data file has the maximum possible size, as determined by the value of the MAX argument in the OCCURS . . . DEPENDING clause: OCCURS min TO max TIMES DEPENDING ON field-name Each record can then store the maximum number of items in the list defined by the OCCURS . . . DEPENDING clause. If you omit this argument, DEC DATATRIEVE does not create a file with fixed-length records of the maximum possible size. The size of each record is determined when you store the record. If the file is defined as a sequential file, a record size cannot be increased to include more list items after it is initially stored. KEY = field-name Causes DEC DATATRIEVE to create an RMS indexed file and specifies a field in the domain's record definition to be used as an index key for the domain's data file. The first key field specified in the DEFINE FILE command is the primary key, and all subsequent ones are alternate keys. If you specify more than one KEY clause, use a comma (,) to separate each clause from the next. If you are defining a file for a hierarchical record, do not make a list field the primary key. If you omit this clause, DEC DATATRIEVE creates an RMS sequential file. CHANGE Determines whether or not you can modify the content of the associated key field. The default is NOCHANGE for the primary key field and CHANGE for alternate key fields. See Allowed Combinations of Key Field Attributes for the allowed combinations of key field attributes. DUP Determines whether or not you can assign the same value to the specified key fields of two or more records. The default is NO DUP for the primary key field and DUP for alternate key fields. See Allowed Combinations of Key Field Attributes for the allowed combinations of key field attributes. Table 1-2 Allowed Combinations of Key Field Attributes Key Field Attributes CHANGE NO Key CHANGE + NO CHANGE NO CHANGE Type + DUP DUP + DUP + NO DUP Primary Not Not Allowed Allowed Allowed Allowed AlternatAllowed Allowed Allowed Allowed USING fdl-file-spec Specifies the FDL file to be used in creating the RMS file. A complete file specification has the following format: node-spec::device:[directory]file-name.type;version
2 – Examples
The following example shows how to define an indexed file for the domain PAYABLES using the field NAME as the primary key and TYPE as the alternate key, and allowing no changes to the alternate key: DTR> DEFINE FILE FOR PHONES KEY=NAME(DUP), KEY=TYPE(NO CHANGE) DTR> The following example defines a sequential file for the domain FAMILIES: DTR> DEFINE FILE FOR FAMILIES DTR> The following example shows how to define a new indexed file for the domain YACHTS using the group field TYPE as the primary key, allowing duplicate values for this key. This command replaces the previous data file for YACHT. DTR> DEFINE FILE FOR YACHTS SUPERSEDE, KEY=TYPE (DUP) DTR> The following example defines a new file for the YACHTS domain using the specifications included in YACHTS.FDL, a file created outside of DEC DATATRIEVE: DTR> DEFINE FILE FOR YACHTS USING YACHTS.FDL DTR>