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

Opening a UDB or UDB Pair for Access by NCL
Working With Files
106160 Tandem Computers Incorporated 12–27
After a UDB or UDB pair is assigned a system-wide UDB ID by the UDBCTL
command, the NCL process uses multiple FILE OPEN verbs to open the UDB or
UDB pair. Each FILE verb uses both the UDBID operand, which specifies the
UDB ID of the UDB or UDB pair, and the ID operand, which specifies a different
local file identifier. This allows a UDB or UDB pair to have different local file
identifiers.
The following code segment illustrates this for a single UDB:
INTCLEAR
INTCMD "UDBCTL OPEN=$DATA.SUBVOL.MYFILE ID=UDBID1"
INTREAD
INTCONT
FILE OPEN UDBID=UDBID1 ID=FILEID1
FILE OPEN UDBID=UDBID1 ID=FILEID2
FILE GET ID=FILEID1 KEY=ABC
FILE GET ID=FILEID2 ALTKEY=XYZ
The following code segment illustrates this for a UDB pair:
INTCLEAR
INTCMD "UDBCTL OPEN=($DATA.SUBVOL.MYFILE1,",
"$DATA.SUBVOL.MYFILE2) ID=UDBID1"
INTREAD
INTCONT
FILE OPEN UDBID=UDBID1 ID=FILEID1
FILE OPEN UDBID=UDBID1 ID=FILEID2
FILE GET ID=FILEID1 KEY=ABC
FILE GET ID=FILEID2 ALTKEY=XYZ
The following NCL procedure shows how to assign multiple local identifiers to the
same UDB. The procedure displays the current UDB ID and the current local file
identifier as it is changed by each FILE verb.
zex1202n: PROCEDURE
/* Uses FUP to create a new entry-sequenced file */
/* Opens file using UDBCTL OPEN and FILE OPEN */
/* Fully qualified file name is first parameter */
&filename = &1
&id = ZEX1202N
ON ERROR FLUSH
INTCMD "OPSYS SEND FUP CREATE "&filename,
", TYPE E"
DO UNTIL &msgno = "NNM0999" OR &found > 0
INTREAD VARS=(&msgno(7),*,&text),
TYPE=ANY PARSE=NO
&found = POS("CREATED -",&text)