RDB/VMS Relational Database Operator INVOKE — VMS CDD+_4.1A
Specifies the name of the database to be accessed in a program or by RDO. You must issue an INVOKE DATABASE statement before you can use any other statement to reference data in that database. Using INVOKE is equivalent to declaring an external subroutine; it declares the database to the program. Example: RDO> INVOKE DATABASE FILENAME 'DISK2:[DEPT4]PERSONNEL'
Additional information available:
Format
INVOKE DATABASE ───┐ ┌─────────────┘ └───┬─────────────────────>────────────────────────┬────┐ ├───────>─────────┬────────> db-handle ──> typebox (=) ──┘ │ ├──>
E
X
T
E
R
N
A
L ────┤ │ ├──>
G
L
O
B
A
L ──────┤ │ └──>
L
O
C
A
L ───────┘ │ ┌─────────────────────────<─────────────────────────────┘ └──┬─────────>─────────┬──┬──>
P
A
T
H
N
A
M
E ───> path-name ──┬─┐ └──>
C
O
M
P
I
L
E
T
I
M
E ───┘ └──>
F
I
L
E
N
A
M
E ───> file-spec ──┘ │ ┌──────────────────────────<───────────────────────────────┘ └──┬─────────────────────────>────────────────────────────┬───┐ └──>
R
U
N
T
I
M
E Ftypebox (I)typebox (L)typebox (E)typebox (N)typebox (A)typebox (M)typebox (E) ────┬────> file-spec ────────┬───┘ │ └────> host-variable ────┘ │ ┌──────────────────────────<──────────────────────────────────┘ └──┬─────────────────────────>───────────────────────┬──────────> └──>
D
B
K
E
Y
S
C
O
P
E
I
S ───┬───>
C
O
M
M
I
T ──────┬───────┘ └───>
F
I
N
I
S
H ──────┘
Additional information available:
COMPILETIMERUNTIMECOMMITFINISH
db-handlepath-namefile-spechost-variable
db-handle
A host language variable that you associate with the name of the database. Use database handles when you are accessing more than one database at a time. Do not declare a host language variable explicitly for the database handle. The Rdb/VMS preprocessors declare the variable for you. You can make a handle local to the module in which it is declared (LOCAL), or global to all modules that declare the database (GLOBAL, EXTERNAL). The default is GLOBAL.
path-name
A full or relative data dictionary path name, enclosed in quotation marks, specifying the source of the database definitions.
file-spec
A full or partial VMS file specification, enclosed in quotation marks, specifying the source of the database definitions.
host-variable
A valid host language variable that equates to a database file specification.
COMPILETIME
The source of the database definitions when the program is compiled. This can be either a data dictionary path name or a VMS file specification. If you specify only the COMPILETIME identifier and omit the RUNTIME identifier, Rdb/VMS uses the COMPILETIME identifier for both compiling and running the program.
RUNTIME
The source of the database definitions when the program is run. This can be either a VMS file specification or a host language variable. If you do not specify this parameter, Rdb/VMS uses the COMPILETIME identifier for both compiling and running the program.
COMMIT
Specifies that the database key of each record used in a program is guaranteed not to change during the transaction. Once a COMMIT (or ROLLBACK) is executed, the database keys are no longer guaranteed not to change.
FINISH
Specifies that the database key of each record used in a program is guaranteed not to change until the program ends or executes a FINISH statement. Once the program ends or a FINISH statement is executed, the database keys are no longer guaranteed not to change.
Examples
Example 1
The following example invokes a database in RDO:
RDO> INVOKE DATABASE PATHNAME 'DISK1:[DICTIONARY]CORP.MIS.PERSONNEL'
This example uses the data dictionary definitions in
DISK1:[DICTIONARY]CORP.MIS.PERSONNEL to invoke the PERSONNEL database
in RDO.
Example 2
The INVOKE DATABASE statement must be part of every program:
&RDB& INVOKE DATABASE FILENAME 'DISK2:[DEPT3]PERSONNEL'
This statement declares the database defined by the file
specification DISK2:[DEPT3]PERSONNEL. The preprocessor then uses
this definition when compiling the program, and Rdb/VMS uses the
database file DISK2:[DEPT3]PERSONNEL.RDB when the program runs.
Example 3
The following BASIC example invokes a database using an EXTERNAL
database handle:
&RDB& INVOKE DATABASE EXTERNAL
&RDB& PERSONNEL = PATHNAME 'DISK1:[DICTIONARY]CORP.MIS.PERSONNEL'
This example shows a global declaration. Other modules in the
program can refer to the database using the handle PERSONNEL; they
must use the same database handle for the same database. The program
does not declare the variable.
o GLOBAL and EXTERNAL are synonymous. These make the database
handle global to all modules that declare the database. Rdb/VMS
creates a PSECT containing one longword using the name supplied
by the user with the overlay attribute.
o The default database scope is GLOBAL.
o The preprocessor generates declarations for all database handles.
Example 4
The following COBOL example uses the COMPILETIME and RUNTIME options:
&RDB& INVOKE DATABASE LOCAL PERSONNEL =
&RDB& COMPILETIME PATHNAME
&RDB& 'DISK1:[DICTIONARY]ACCT.PERSONNEL'
&RDB& RUNTIME FILENAME
&RDB& 'USERDISK3:[DEPT3]PERSONNEL'
This example declares the database using two different sources:
o At compile time, the preprocessor uses the database definitions
in the data dictionary.
o At run time, Rdb/VMS uses the definition in file
USERDISK3:[DEPT3]PERSONNEL.RDB.