NET/MASTER Network Control Language (NCL) Programmer's Guide

Opening a UDB or UDB Pair for Access by NCL
Working With Files
106160 Tandem Computers Incorporated 12–37
control over the value of a record key when a record is written to an entry-sequenced
file. (Remember, you cannot modify an edit file.)
You can modify the value of the record key in a key-sequenced file. When NCL writes
a record to a key-sequenced file, it automatically constructs the record key of the
record from the value of &SYS.FILE.KEY. It constructs the rest of the record from the
variables that contain the data.
The following example specifies that the record key is not regarded as part of the data
in a record when the specified UDB or UDB pair is opened:
FILE OPEN ID=FILEID_1 KEYEXTR=YES
Including the Record Key in the Data
If you specify KEYEXTR=NO when you open a UDB or UDB pair, NCL regards the
record key as part of the data in the record. The result is that when you retrieve a
record from a UDB or UDB pair by using the FILE GET verb, NCL automatically
places the value of the record in the system variable &SYS.FILE.KEY and then reads
the data from the entire record, including the record key, into the variables you
specify.
The following example specifies that the record key is regarded as part of the data in a
record when the specified UDB or UDB pair is opened:
FILE OPEN ID=FILEID_1 KEYEXTR=NO
Record Structure and
Record Keys
You should be very careful if you change the default values of the FORMAT and
KEYEXTR operands of the FILE OPEN verb. Unpredictable results may occur from
certain combinations, as described next.
Recommendations for Record Structure and Record Keys
As a general rule, it is recommended that you do not change the default value of the
FORMAT and KEYEXTR operands unless it is necessary to interpret the data in an
existing file, for example, when you are reading an edit file (where you normally
specify FORMAT=UNMAPPED). The default value of the FORMAT operand is
MAPPED; the default value of the KEYEXTR operand is YES.
If you do change the default value of either operand, it is recommended that you use
the same value of KEYEXTR and the same variable set when both reading from and
writing to a UDB.
Mapped UDBs. If you are working with a key-sequenced file, unpredictable results may
occur if you specify that the file is mapped and set KEYEXTR=NO, unless the map is a
user-defined map. (If the map is a user-defined map, you must specify
KEYEXTR=NO. See Section 11, “Standard and User-Defined Maps,” for more
information on the effect of the KEYEXTR operand when using user-defined maps.)