The 4GL_COMMIT_COUNT variable sets the conditions used to issue an automatic COMMIT-WORK operation. Valid values are:
0
(Default) |
The run time system tracks the number of logical locks that are currently in effect. When the number of logical locks reaches zero, the run time system assumes that a transaction is complete and issues a COMMIT statement |
n | When set to a nonzero value, the run time system tracks the number of WRITE, REWRITE, and DELETE operations, until the value of 4GL_COMMIT_COUNT is reached, at which time the run time system issues a COMMIT statement. The READ, START, and READ NEXT operations do not count toward this total, because the run time system is tracking data-altering operations rather than logical record locks. The disadvantage of this method is that when a COMMIT is issued, any record locks held by the run time system are released |
-1 | No commit is issued by Database Connectors |
When 4GL_COMMIT_COUNT is set to -1, the following alternate methods to perform a commit or rollback are available:
4GL_COMMIT_COUNT is set to -1 automatically when you use the transaction management facilities available in the compiler. A COMMIT WORK is, however, issued on exit from the run time system (for example, on execution of a STOP RUN).
Examples
4GL_COMMIT_COUNT 0
A commit is issued when no locks are held, either because all files that had locked records are closed, or because a COBOL COMMIT verb has been issued. This is the default value.
Note that some data sources lose the current row when a COMMIT or ROLLBACK is executed. For these data sources, setting 4GL_COMMIT_COUNT to 0 can slow performance.
4GL_COMMIT_COUNT n
A commit is issued after n operations. WRITE, REWRITE, and DELETE count towards n; READ, START, and READ NEXT do not.
4GL_COMMIT_COUNT -1
No commit is issued by Database Connectors. When 4GL_COMMIT_COUNT is set to -1, the only way to perform a commit or rollback is to use the COBOL verbs COMMIT and ROLLBACK.
4GL_COMMIT_COUNT is set to -1 internally when you use the transaction management facilities available in your COBOL development system.
A COMMIT is issued on exit from the run time system (for example, on execution of a STOP RUN).