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

Opening a UDB or UDB Pair for Access by NCL
Working With Files
12–22 106160 Tandem Computers Incorporated
Opening a UDB or
UDB Pair for Access
by NCL
The FILE OPEN verb opens a UDB or UDB pair for processing by subsequent FILE
verbs. You must open a UDB or UDB pair by using the FILE OPEN verb before any
other FILE verb can work with the UDB or UDB pair.
Specifying the UDB
Identifier
The FILE OPEN verb must specify the UDB ID of a UDB or UDB pair when it opens
the UDB or UDB pair from an NCL process by using the ID operand. This establishes
a logical connection between the NCL process and the UDB or UDB pair.
The following code segment uses the UDBCTL OPEN command from NCL to open a
UDB for system-wide access. It uses the FILE OPEN verb to open the UDB from NCL:
INTCLEAR
INTCMD "UDBCTL OPEN=$DATA.SUBVOL.MYFILE ID=UDBID1"
INTREAD
INTCONT
FILE OPEN ID=UDBID1
The following code segment uses the UDBCTL OPEN command from NCL to open a
UDB pair for system-wide access. It uses the FILE OPEN verb to open the UDB pair
from NCL:
INTCLEAR
INTCMD "UDBCTL OPEN=($DATA.SUBVOL.MYFILE1,",
"$DATA.SUBVOL.MYFILE2) ID=UDBID1"
INTREAD
INTCONT
FILE OPEN ID=UDBID1
Although the FILE OPEN verb must specify a UDB ID when it opens a UDB or UDB
pair, specifying an identifier on other FILE verbs is optional. If a FILE verb does not
explicitly specify an identifier, NCL assumes that the FILE verb refers to the UDB or
UDB pair identified by the current identifier. Explicitly setting the current identifier
and other UDB characteristics using the FILE SET verb is discussed later in this
section.
The following NCL procedure illustrates the mechanics of opening and closing a UDB
from NCL. It explicitly specifies a UDB ID, ZEX1201N.
zex1201n: 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
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