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

Opening a UDB or UDB Pair for Access by NCL
Working With Files
12–36 106160 Tandem Computers Incorporated
Figure 12-13. Records in a Delimited Key-Sequenced File
ADAMS, J.P. 'FF'X EISENHOWER AV 'FF'X 408 414-5999 'FF'X
JOHNSON, A.B. 'FF'X RED RD 'FF'X 929 43-4345 'FF'X
JONES, P. 'FF'X FIRST ST 'FF'X
BOND, J. 'FF'X ANDERSON DR 'FF'X 408 43-1239 'FF'X
'FF'X
15 'FF'X
30 'FF'X
037
'FF'X01
02
03
04
55 'FF'X
Handling the Record Key UDB records have keys. When you open a UDB or UDB pair using the FILE OPEN
verb, you can specify how you want NCL to handle the record key of each record.
You do so using the KEYEXTR operand of the FILE OPEN verb. The setting of this
operand affects how NCL places components of a record into variables when it gets a
record from a UDB or UDB pair with the FILE GET verb. It also affects what NCL
does when it adds or replaces a record in a UDB or UDB pair with the FILE ADD and
FILE PUT verbs.
The record key of a UDB is held in the system variable &SYS.FILE.KEY.
Note The following discussion assumes that the record key starts at offset 0 in a record.
Excluding the Record Key From the Data
If you specify KEYEXTR=YES when you open a UDB or UDB pair, NCL does not
regard the record key as part of the data in a record. The result is that, when you
retrieve a record from a UDB or UDB pair using the FILE GET verb, NCL
automatically places the value of the record key in the system variable &SYS.FILE.KEY
and then reads the data from the rest of the record into the variables you specify.
After retrieving a record:
If the UDB is entry-sequenced, the system variable &SYS.FILE.KEY contains the
logical record number multiplied by 1000: for example, the value 9000 is the
record key of the ninth record.
If the UDB or UDB pair is key-sequenced, the system variable &SYS.FILE.KEY
contains the value of the record key of the record: for example, the value 9 may be
the record key of the ninth record.
If the UDB is an edit file, the system variable &SYS.FILE.KEY contains the line
number of the record excluding the decimal point: for example, the value 9000 is
the line with the edit line number of 9.000.
You cannot modify the value of the record key in entry-sequenced files and edit files.
The value contained in &SYS.FILE.KEY is for your information only. You have no