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

Working With Single Key-Sequenced Files
Working With Files
106160 Tandem Computers Incorporated 12–67
Updating a Record in an Unmapped Key-Sequenced File
The following code segment presents all records for update in an unmapped
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
/* Fix length of field at 20 bytes */
&field&fno = LEFT(&field&fno,20)
END /*&fno do*/
FILE PUT KEY=&key VARS=&field*
END /*do*/
Updating a Record in a Delimited Key-Sequenced File
The following code segment presents all records for update in a delimited
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*/
FILE PUT KEY=&key VARS=&field*
END /*do*/