Dictionary L-Type Records

Top  Previous  Next

 

An L-type record represents a link to another file. It can be used in query processor commands to reference fields in a dependent file without the need to create an I-type TRANS() expression for each field. Links can also be used within I-type expressions to minimise the number of explicit TRANS() operations.

 

1:L  { descriptive text }
2:Id expression
3:File name

 

The expression in field 2 is constructed in exactly the same was as an I-type expression and derives the record id of the record(s) in the linked file from data in the original file.

 

Links can be used to reference D or I-type items in the remote file. They cannot be used to access Pick style A or S-type items.

 

 

Examples

 

If a library application has two files, BOOKS and TITLES where the record id of BOOKS is formed from the id of the corresponding TITLES record and the copy number separated by a hyphen, the following link placed in the dictionary of the BOOKS file could be used to access the associated TITLES record:

 

1:  L

2:  @ID['-', 1, 1]

3:  TITLES

 

Queries based on the BOOKS file could then reference data from the TITLES file using field names made up from the name of the link record, a % character and the name of the TITLES field to be accessed. For example, if the above line was named TTL, a query such as

LIST BOOKS TTL%TITLE TTL%AUTHOR

could be used to print a list of book titles and their authors.

 

 

The same data could be referenced in an I-type item in the dictionary of the BOOKS file by use of simply

TTL%TITLE

as the expression (field 2). This is exactly equivalent to writing

TRANS(TITLES, @ID['-' , 1, 1], TITLE, 'X')

Use of links in this way removes the need to include the link expression (@ID['-', 1, 1]) in every reference to items in the TITLES file. Because use of a link causes a compile time substitution of the actual TRANS() operation, changing the link record requires all I-types that use it to be recompiled.