Explicitly declares a database closed. By default, the FINISH statement with no parameters also commits all transactions that have not been committed or rolled back. When used in conjunction with the /NODEFAULT_TRANSACTIONS qualifier on the RDML command line, issuing the FINISH statement before you explicitly end a transaction (with the COMMIT or ROLLBACK statement) will result in an error.
1 – Examples
The following program fragments: o Declare a database o Enter an RDML FOR loop, implicitly opening the database o Print the last name of each employee in EMPLOYEES o Commit the transaction o Close the database
1.1 – C Example
#include <stdio.h> DATABASE PERS = FILENAME "PERSONNEL"; main() { FOR E IN EMPLOYEES printf ("%s\n", E.LAST_NAME); END_FOR; COMMIT; FINISH; }
1.2 – Pascal Example
program empupdate (input,output); DATABASE PERS = FILENAME 'PERSONNEL'; begin FOR E IN EMPLOYEES writeln (E.LAST_NAME); END_FOR; COMMIT; FINISH; end.
2 – Format
(B)0[m[4mFINISH[m qqqwqqq>qqqqqqqqqqqqqqqwqwqq>qqqqqqqqqqqqqwqq> mqwq> db-handle qwqqj mqq> on-error qqqj mqqqqq , <qqqqqj
2.1 – Format arguments
db-handle Database handle. A host variable used to refer to a specific database you have invoked. For more information see the entry on the Database Handle clause. on-error The ON ERROR clause. Specifies host language statement(s) to be performed if an error occurs during the FINISH operation. For more information see the entry on ON ERROR.