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;