RDB/VMS Relational Database Operator READY — VMS RDB_4.2
In programs, the READY statement explicitly declares your intention to access one or more databases and causes an attach to the database. READY is not available in RDO. You do not have to use READY to access a database. A database is readied automatically the first time you refer to it. However, you do need an INVOKE DATABASE statement. If you issue a READY statement without specifying a database handle, Rdb/VMS opens all databases declared in that module.
Additional information available:
More
You need the Rdb/VMS READ privilege for the database to use the READY statement. You can use the READY statement to test the availability of a database. For example, you may want to check availability before your program prompts a user for input.
Format
READY ───┬────>──────────────┬───┬────>─────────────┬─────>
└─┬──> db-handle ─┬─┘ └────> on-error ───┘
└────── , <─────┘
Additional information available:
db-handle
Database handle. A host language variable used to refer to a specific database your program invokes.
on-error
The ON ERROR clause. Specifies host language statement(s) to be performed if an error occurs during the READY operation.
Examples
Example 1
The following program fragments demonstrate the use of the READY
statement to open a database. The program fragments:
o Use the INVOKE DATABASE statement to declare the PERSONNEL
database
o Declare a database handle PERS for PERSONNEL
o Open the PERSONNEL database with the READY statement
o Close the database with the FINISH statement
C Program
#include <stdio.h>
DATABASE PERS = FILENAME "WORK$DISK:PERSONNEL";
.
.
main ()
{
READY PERS;
.
.
.
FINISH PERS;
Pascal Program
program empupdate;
DATABASE PERS = FILENAME 'WORK$DISK:PERSONNEL';
.
.
.
begin
READY PERS;
.
.
.
FINISH PERS;
Example 2
The following program fragments demonstrate how to open two databases
within the same program. The program fragments:
o Use the DATABASE statement to declare two databases, PERSONNEL
and PAYROLL
o Declare database handles for both databases
o Open both databases
o Close each database
C Program
#include <stdio.h>
DATABASE PERS = FILENAME "WORK$DISK:PERSONNEL";
DATABASE PAY = FILENAME "WORK$DISK:PAYROLL";
main ()
{
.
.
.
READY PERS;
.
.
.
FINISH PERS;
.
.
.
READY PAY;
.
.
.
FINISH PAY;
.
.
.
READY PERS, PAY;
.
.
.
FINISH PERS, PAY;
Pascal Program
program new_employee;
DATABASE PERS = FILENAME 'WORK$DISK:PERSONNEL';
DATABASE PAY = FILENAME 'WORK$DISK:PAYROLL';
.
.
.
READY PERS;
.
.
.
FINISH PERS;
.
.
.
READY PAY;
.
.
.
FINISH PAY;
.
.
.
READY PERS, PAY;
.
.
.
FINISH PERS, PAY;