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

Working With Entry-Sequenced Files
Working With Files
12–50 106160 Tandem Computers Incorporated
Mapped Using a Map Other Than $NCL. If the data is mapped using a map other than
$NCL (such as $MSG, $SEC, or a user-defined map), then you must specify the MDO
keyword and the name of an MDO variable when you get the record. The FILE GET
verb gets a record and places it into the MDO variable using the correct map. The
following example uses the FILE GET verb to get a record and place it in the MDO
variable &SEC.:
FILE GET MDO=&sec.
The following code segment gets all records from a mapped entry-sequenced file
beginning at the first record:
/* Get records and displays them on OCS window */
ASSIGN MDO=&rec. MAP=$NCL
FILE GET 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 MDO=&rec.
END /*do while*/
The FILE GET verb obtains the data in the MDO variable &REC.. The ASSIGN verb
then transfers the data from the MDO variable &REC. to the ordinary &FIELD*
variables.
Getting a Record From an Unmapped Entry-Sequenced File
When you get a record from an unmapped entry-sequenced file, NCL makes no
attempt to identify individual fields in the record; it treats the record as a single string.
The data is either automatically split into as many variables as are necessary to hold
the data, or it is placed into variables according to the criteria you specify: for
example, using the PARSE and SEGMENT operands, or the VARS keyword with
length variable specifications. Refer to the text on verb syntax and variable access
methods in the NonStop NET/MASTER NCL Reference Manual for a discussion of these
techniques.