Define DI

PURPOSE:  ACCENT R offers two ways to create an index, with DEFINE DI or CREATE DS.

The basic command, DEFINE DI, places control at the edit level, where all domains of the Data Index (DI) can be defined or refer to an Index Definition (ID) containing the domains for the DI.  This command gives maximum flexibility to control options.  It also allows multiple domains, each with multiple fields.

The KEYED ON clause (in the CREATE DS command) can be used to create a RAM DI at the same time as the Data Set (DS) if the default options are desired.  This command allows more than one domain, but each domain can have only one field.  See CREATE DS earlier in this Chapter.

The DEFINE DI command and the KEYED ON clause of the CREATE DS command creates the definition of the DI, include an entry for it in the Data Base Library (DBL), and establishes an empty System File (SF).  The definition can then be displayed by the command LIST DI name.

The DI itself is not built until it is used for the first time, or until the FORM DI, command is given.

SYNTAX

DEFINE DI name [IN DBL dbl_name]

[ATTACH; CREATE /IF MISSING/ ENTRY /ONLY/]

name

is the user-assigned name of the DI.  If an extension is not specified, the default extension DI is used.

[IN DBL dbl_name]

is used to define the DI entry in a DBL other than the current one.  A DI must be stored in the same DBL as the DS that it indexes.  If an IN DBL clause is included, the DI will be cataloged in the DBL named in that clause.  Otherwise, it will be cataloged in the current DBL.

ATTACH

is used to create the definition when the System File (SF) for the DI already exists.  The text must be entered that defines the DI.  Attaching does not cause the existing index to reform, but flags it as obsolete.  The DI must then be formed by the FORM command before it can be used.

CREATE/IF MISSING/

defines the DBL entry of the specified DI, checks for the existence of the associated System File when the DI definition is saved, and creates the System File if it does not exist.

ENTRY/ONLY/

creates the definition for the specified DI, but it does not check for the existence of the associated SF or attempt to create one when the entry is saved.

EXAMPLE

*DEFINE DI BOOKS_DBM2
--INSERT
--00100  INDEX TYPE IS RAM
--00110  INDEX TO BOOKS_DBM2
--00120  !
--00130  DOMAIN TITLE_CODE ON TITLE_CODE
--00140  DUPLICATES NOT ALLOWED
--00150  !
--00160  DOMAIN TYPE ON TYPE_CODE
--00170  DOMAIN PUB ON PUB_CODE
--00180  END
--SAVE