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

User-Defined Maps
Standard and User-Defined Maps
106160 Tandem Computers Incorporated 11–35
Note A user-defined map does not have elements, only groups and fields.
Using a User-Defined Map After you have created a user-defined map, an NCL process can use the map. An NCL
process uses a user-defined map as it uses a standard map. That is, it uses the names
of substructures within the map to locate data at a certain position in an MDO
variable. Section 10, “Working with Mapping Services,” explains how to use MDO
variables.
The following NCL procedure uses the EMPREC map to write a record to and then
read the record from $DATA2.UDDL.EMPFILE. The NCL procedure assumes that
you have created the EMPREC map and the $DATA2.UDDL.EMPFILE, as described
earlier in this section. (See Section 12, “Working With Files,” for more information on
the FILE verbs, which are used in this NCL procedure.)
To see how this NCL procedure works, follow these steps:
1. Type the NCL procedure as shown, calling it ZEX1105N:
zex1105n: PROCEDURE
/* Opens a mapped key-sequenced file (which is */
/* mapped using a user-defined map), adds a */
/* record, gets the record, displays the record, */
/* then closes the file. */
ON ERROR FLUSH
&usermap = EMPREC
&id = EMPFILE
CALL open_file SHARE &usermap,&id
IF &SYS.FILE.RC = 8 THEN
CALL add_record SHARE &usermap
ELSE DO
SAY "Flushing after OPEN_FILE"
FLUSH
END /*do*/
IF &SYS.FILE.RC = 0 THEN
CALL get_record SHARE &usermap,&getmdo.
ELSE DO
SAY "Flushing after ADD_RECORD"
FLUSH
END /*do*/
IF &SYS.FILE.RC = 0 THEN
CALL display_record( 0, "" ) SHARE &usermap,&getmdo.
ELSE DO
SAY "Flushing after GET_RECORD"
FLUSH
END /*do*/
CALL close_file SHARE &id
EXIT
/* ==================== OPEN FILE ==================== */
open_file: PROCEDURE SHARE &usermap,&id
/* This procedure assumes that the file exists and */
/* has been opened for access by NonStop NET/MASTER. */
/* Therefore, this procedure only opens the file for */
/* access by NCL. (You can use FUP to create a key- */