NET/MASTER Network Control Language (NCL) Programmer's Guide
Working With Entry-Sequenced Files
Working With Files
12–48 106160 Tandem Computers Incorporated
It uses a DO loop to obtain four records. It uses a nested DO loop to obtain four fields
in each record that it places in the ordinary variables—&FIELD*. After data is placed
in each variable, the LEFT built-in function ensures that the data in each field is fixed
at 20 bytes. Since there are 4 fields in a record, the length of each record is fixed at 80
bytes. The FILE ADD verb adds each record to the unmapped entry-sequenced file
using the &FIELD* variables.
Adding a Record to a Delimited Entry-Sequenced File
When you add a record to a delimited entry-sequenced file, NCL automatically inserts
field delimiters (hexadecimal characters ‘FF’) after each field as the record is
constructed. Fields, and therefore records, can be variable length.
The following code segment adds records to a delimited entry-sequenced file:
…
/* Allows you to enter 4 fields for 4 records */
DO &rno = 1 TO 4
DO &fno = 1 TO 4
SAY Enter record &rno field &fno
CMDLINE "-GO ID="&SYS.NCLID _
PAUSE VARS=&field&fno PARSE=NO
END /*&fno do*/
SAY "Adding record "&rno" to "&filename
FILE ADD VARS=&field*
END /*&rno do*/
…
It uses a DO loop to obtain four records. It uses a nested DO loop to obtain four fields
in each record that it places in the ordinary variables—&FIELD*. The FILE ADD verb
adds each record to the delimited UDB using the &FIELD* variables.
Note Adding the hexadecimal characters ‘FF’ to a delimited UDB as data may cause unpredictable results
when NCL attempts to get each field.
Getting a Record The FILE GET verb retrieves a record from an entry-sequenced file. Each FILE GET
statement in an NCL process retrieves one record from a UDB: an NCL process must
issue multiple FILE GET statements to retrieve multiple records.
You can specify the retrieval direction by using the FILE GET verb with the OPT
operand. Table 12-5 lists the options you can use to specify the retrieval direction.
These options apply to both entry-sequenced and key-sequenced files.