DBTG Data Retrieval Facility
The DBTG data manipulation language consists of a number of
commands that are embedded in a host language.
Run unit - system application program consisting of a sequence of
host language and DBTG command statements. Statements access
and manipulate database items as well as locally declared variables.
1.Program work-area (or user work area) - A buffer storage area the system maintains for each application program.
DBTG Variables
-> Record Templates
-> Currency pointers
a. Current of record type
b. Current of set type
c. Current of run unit
-> Status flags
a. DB-status is most frequently used
b. Additional variables: DB-set-name, DB-record-name, and
DB-data-name
Example Program Work Area
-> Templates for three record types: customer, account, and branch.
-> Six currency pointers
a. Three pointers for record types: one each to the most recently
accessed customer, account, and branch record
b. Two pointers for set types: one to the most recently accessed
record in an occurrence of the set depositor, one to the most
recently accessed record in an occurrence of the set account branch
c. One run-unit pointer.
-> Status flags: four variables defined previously
-> Following diagram shows an example program work area state.
DBTG commands for querying the database -
The two most frequently used DBTG commands are The find and get commands:-
1. find - find locates a record in the database and sets the appropriate currency pointers.
2. get - copies of the record to which the current of run-unit points
from the database to the appropriate program work area
template.
Access Of Individual Records -
The find command has a number of forms. we shall present only a few of these commands in this appendix. There are two different find commands for locating individual records in the database. the simplest command has the form:-
find any <record type> using <record-field>
Example: As an illustration, let us construct the DBTG query that prints the street address of Hayes:
The DBTG data manipulation language consists of a number of
commands that are embedded in a host language.
Run unit - system application program consisting of a sequence of
host language and DBTG command statements. Statements access
and manipulate database items as well as locally declared variables.
1.Program work-area (or user work area) - A buffer storage area the system maintains for each application program.
DBTG Variables
-> Record Templates
-> Currency pointers
a. Current of record type
b. Current of set type
c. Current of run unit
-> Status flags
a. DB-status is most frequently used
b. Additional variables: DB-set-name, DB-record-name, and
DB-data-name
Example Program Work Area
-> Templates for three record types: customer, account, and branch.
-> Six currency pointers
a. Three pointers for record types: one each to the most recently
accessed customer, account, and branch record
b. Two pointers for set types: one to the most recently accessed
record in an occurrence of the set depositor, one to the most
recently accessed record in an occurrence of the set account branch
c. One run-unit pointer.
-> Status flags: four variables defined previously
-> Following diagram shows an example program work area state.
DBTG commands for querying the database -
The two most frequently used DBTG commands are The find and get commands:-
1. find - find locates a record in the database and sets the appropriate currency pointers.
2. get - copies of the record to which the current of run-unit points
from the database to the appropriate program work area
template.
Access Of Individual Records -
The find command has a number of forms. we shall present only a few of these commands in this appendix. There are two different find commands for locating individual records in the database. the simplest command has the form:-
find any <record type> using <record-field>
Example: As an illustration, let us construct the DBTG query that prints the street address of Hayes:
customer.customer name:="Hayes";
find any customer using customer name;
get customer;
print (customer.customer street);
find any customer using customer name;
get customer;
print (customer.customer street);