• Aucun résultat trouvé

DEFINE FILE Continued

Dans le document Digital Equipment tion (Page 118-122)

Causes 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,

DATATRIEVE does not create a file with fixed-length records of the maxi-mum possible size. The size of each record is determined when you store it. If you define the file to be a sequential file, you cannot increase the size of a record to include more list items than you first stored in the record.

KEY = field-name

Causes DATATRIEVE to create an RMS indexed sequential file and specifies a field in the domain's record definition to be used as an index key for the domain's data file. When you omit this clause, DATATRIEVE creates an RMS sequential file. The first key field specified in the DEFINE FILE com-mand 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.

(NO) CHANGE

Determines whether or not you can modify the content of the associated key field. See Tables 5-3 and 5-4 for defaults and allowed combinations of key field attributes.

(NO)DUP

Determines whether or not you can assign the same value to the specified key fields of two or more records. See Tables 5-3 and 5-4 for defaults and allowed combinations of key field attributes.

Table 5-3: Default Values for KEY fields Primary Alternate

Key Key(s)

NO CHANGE CHANGE

NODUP DUP

DEFINE FILE

Continued

Table 5-4: Allowed Combinations of Key Field Attributes Key Type

Combinations Primary Alternate CHANGE + DUP Not allowed Default CHANGE + NO DUP Not allowed Not allowed NO CHANGE + DUP Allowed Allowed NO CHANGE + NO DUP Default Allowed

Restrictions

• To define a data file for an RMS domain, you must have A (ACCESS) privilege for the domain and E (EXECUTE) privilege for the record.

• You cannot assign the CHANGE attribute to a primary key. See Table 5-4 for the allowed combinations of key field attributes.

• You cannot designate a list field as the primary key when defining a file for a hierarchical record.

• The domain specified in the command must be an RMS domain, and not a view domain, DBMS-II domain, or port.

Results

• If you do not include a KEY clause, DATATRIEVE creates an RMS sequential data file for the specified domain. If you include one or more KEY clauses, DAT ATRIEVE creates an RMS indexed sequential data file for the domain.

• The file specification for the RMS file created by this command is the same as the file specification defined in the DEFINE DOMAIN command that defined the domain name. If the domain definition omits a field in the file specification, DATATRIEVE uses the following defaults:

Field

dev:

[UIC/PPN]

file-name .type

;ver

Default

SY: (the system device) Your default UIC/PPN No default

.DAT

1 or next higher version number (non-RSTS/E systems only)

DEFINE FILE

Contin~ed

• If you omit the ALLOCATION = n clause, DATATRIEVE sets the initial disk space allocation for the data file to zero blocks. When you store records in the data file, RMS automatically extends the data file according to the cluster size on RSTS/E systems and the default extension size on RSX systems.

• If the record definition associated with the specified domain contains no OCCURS ... DEPENDING clause, DATATRIEVE creates a data file with a fixed-length record format.

• If the record definition associated with the specified domain contains an OCCURS ... DEPENDING clause, DATATRIEVE creates a data file as follows:

- If the clause does not include the MAX argument, DATATRIEVE creates a file with a variable-length record format.

- If the clause includes the MAX argument, DATATRIEVE creates a data file with a fixed-length record format.

• If you include the SUPERSEDE argument and the file specification in the domain definition specifies a version number, DATATRIEVE deletes any exist-ing data file havexist-ing that file specification and version number and replaces it with the new data file created by the DEFINE FILE command. The new file has the same file specification including version number, if applicable, as that of the deleted file ..

Usage Notes

• If you define a sequential file, you cannot delete records from it with the

ERASE statement. You can, however, change the value of any field in a record in a sequential file.

• If you define an indexed sequential file, you can delete records from it with the ERASE statement. You cannot, however, change the value of the primary key field of a record or the value of any secondary key field with the NO CHANGE attribute.

• If you change the size of a record, you need to define a new file to agree with the new record definition. Otherwise, you receive an error message indicating ((bad record size" when you try to ready the domain.

• If you define a sequential file for a hierarchical record(OCCURS ... DEPEND-ING) and do not include a MAX clause, you cannot extend the length of the list without defining a new file.

• If you define an indexed sequential file for a hierarchical record

(OCCURS ... DEPENDING) and do not use MAX, you can extend the length of the list.

• See Chapter 6 in theDATATRIEVE-ll User's Guide for more information on defining data files.

DEFINE FILE

Continued

Examples

Define an indexed file for the domain PHONES. Use the field NAME as the pri-mary key:

OTR> DEFINE FILE FOR PHONES KEY = NAMEffim OTR>

Define a sequential file for the domain FAMILIES:

OTR> DEFINE FILE FOR FAMILIES(BfI) DTR>

Define a new indexed file for the domain YACHTS. Use the group field TYPE as the primary key, and allow duplicate values for this key. This command replaces the previous data file for Y AeHTS:

DTR> DEFINE FILE FOR YACHTS SUPERSEDE KEY=TYPE (DUP)(BfI) OTR>

Dans le document Digital Equipment tion (Page 118-122)