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

Working With Single Key-Sequenced Files
Working With Files
12–64 106160 Tandem Computers Incorporated
The FILE SET verb sets the value of the partial key to JOHNSON. The first FILE GET
verb finds the first record in the key-sequenced file that matches the partial key of
JOHNSON. It sets the retrieval direction of subsequent FILE GET verbs to forward.
Subsequent FILE GET verbs, which use the same OPT operand, sequentially retrieve
all other records that match the partial key of JOHNSON.
Getting a Record From a Mapped Key-Sequenced File
The following code segment gets all records from a mapped key-sequenced file,
beginning at the first record:
/* Get records and displays them on OCS window */
ASSIGN MDO=&rec. MAP=$NCL
FILE GET OPT=SEQ MDO=&rec.
DO WHILE &SYS.FILE.RC = 0
ASSIGN VARS=&field* FROM MDO=&rec.
DO &fno = 1 TO &SYS.VARCNT
SAY "Field "&fno" is "&field&fno
END /*do*/
FILE GET OPT=SEQ MDO=&rec.
END /*do while*/
Getting a Record From an Unmapped Key-Sequenced File
The following code segment gets all records from an unmapped key-sequenced file,
beginning at the last record:
/* Get records and displays them on OCS window */
FILE GET OPT=BWD VARS=&field* SEGMENT=20
DO WHILE &SYS.FILE.RC = 0
DO &fno = 1 TO &SYS.VARCNT
/* Use | to show exact field length */
SAY "Field "&fno" is |"&field&fno"|"
END /*do*/
FILE GET OPT=SEQ VARS=&field* SEGMENT=20
END /*do while*/