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

Working With Single Key-Sequenced Files
Working With Files
12–66 106160 Tandem Computers Incorporated
Note When you obtain exclusive access to a record, you should ensure that the NCL process relinquishes the
locked record as quickly as possible. It is not good practice to lock a record and then display a panel that
waits for operator input since this may delay access to the record by other NCL processes.
Updating a Record in a Mapped Key-Sequenced File
The following code segment presents all records for update in a mapped
key-sequenced file (the value of the record key is obtained before executing this code
segment):
/* Updates a record and adds to a file */
/* Key is obtained before presenting fields for update */
&answer = N
SAY "Update record? (Y/N) Default=N"
CMDLINE "-GO ID="&SYS.NCLID _N
PAUSE VARS=&answer PARSE=NO SEGMENT=1
IF UPPER(&answer) = Y THEN DO
DO &fno = 1 TO 4
SAY Enter record &key field &fno
CMDLINE "-GO ID="&SYS.NCLID
PAUSE VARS=&field&fno PARSE=NO
END /*&fno do*/
ASSIGN MDO=&rec. MAP=$NCL FROM VARS=&field*
FILE PUT KEY=&key MDO=&rec.
END /*do*/