NET/MASTER Network Control Language (NCL) Reference Manual
&SYS.FILE.KEY
System Variables
5–40 106126 Tandem Computers Incorporated
&SYS.FILE.KEY The &SYS.FILE.KEY system variable contains the value of the full key of the last
record read from a UDB. It can be used to refer to the explicit key of each record read
from a UDB when a file is being read using partial keys.
&SYS.FILE.KEY reflects the unique position of an NCL process within its currently
active file.
&SYS.FILE.KEY
Considerations
For more information on partial keys, see the FILE GET verb in Section 3, “Verbs.”
Example
The following example opens a file, sets a user variable (&KEY) to a file's key value,
attempts to read a record using that key, and tests the &SYS.FILE.RC system variable
for the result of the operation. The &SYS.FILE.KEY system variable and the
&SYSMSG variable are displayed if there is an error:
FILE2:PROCEDURE
&KEY=0001
/* open the file TEST1 */
FILE OPEN ID=TEST1
/* then read a record */
FILE GET ID=TEST1 KEY=&KEY OPT=UPD ARGS
SAY &SYS.FILE.RC "= FILE ERROR CODE"
IF &SYS.FILE.RC \= 0 THEN DO
WRITE DATA="Read failed for record "&SYS.FILE.KEY
SAY "&SYSMSG = " &SYSMSG
END
END FILE2
When the preceding NCL procedure was executed, &SYS.FILE.KEY contained the
value 0 (zero), and the file error code was 16. The &SYSMSG variable contained the
error message:
NNM0319 FILE GET ERROR, ID=TEST1 - KEY LENGTH EXCEEDS MAXIMUM.