RDB/VMS Relational Database Operator FINISH — VMS RDB_4.1A
Explicitly declares a database closed when you are done working with
it. FINISH with no parameter also commits all active transactions.
It is recommended that you use FINISH before exiting from a program.
Example:
999-EOJ.
IF BAD-FLAG = 1
THEN
&RDB& ROLLBACK
ELSE
&RDB& COMMIT
&RDB& FINISH
CLOSE JOBHST-FILE.
STOP RUN.
Additional information available:
More
If you have invoked a database, you have the necessary privileges to use the FINISH statement. When you use INVOKE to declare databases and then use the START_TRANSACTION statement, the Rdb/VMS preprocessors automatically attach your process to all the databases you have invoked. This involves some overhead and record locking. If the FINISH statement occurs explicitly in the run-time flow of the program, Rdb/VMS detaches from the database mentioned in the FINISH. If another START_TRANSACTION occurs, Rdb/VMS attaches to the databases again. Therefore, if your program uses databases sequentially, you can use FINISH to close each database as you are finished working with it. In this way, Rdb/VMS attaches only the databases you need at any one time.
Format
FINISH ───┬───────────────────┬─┬────────────────┬──>
└─┬─> db-handle ─┬──┘ └──> on-error ───┘
└───── , <─────┘
Additional information available:
db-handle
A host language variable that identifies the database to be accessed. Use the db-handle that you associated with the database in the INVOKE statement.
on-error
Specifies host language statements or Rdb/VMS data manipulation statements to be performed if an Rdb/VMS error occurs. For more details, request HELP on ON_ERROR.
Example
The following fragment shows how to use INVOKE and FINISH to work
with two databases:
&RDB& INVOKE DATABASE WORKERS =
&RDB& FILENAME 'DISK2:[DEPT4]EMPLOYEES'
&RDB& INVOKE DATABASE PARTS =
&RDB& FILENAME 'DISK2:[DEPT4]PARTS'
.
.
.
! [This part of the program can combine data from
both databases]
.
.
.
&RDB& FINISH WORKERS
.
.
.
! [This part of the program uses only
the PARTS database]
.
.
.
&RDB& FINISH PARTS
Between the second INVOKE statement and the first FINISH, you can
access both databases at once.