Joined: 20 Oct 2006 Posts: 6970 Location: porcelain throne
have had a little too much of myself lately,
so i offer this:
This is written from a Batch prospective,
as far as what go on in a COBOL Thread (task):
there is no such thing as an IMPLICIT or EXPLICIT COMMIT.
either you code for it and
-------the unit-of-work for that task is COMMITted, and you continue executing, db2 storing current-unit-of-work-status (type stuff) until the next COMMIT or ROLLBACK or STOP RUN (or GOBACK from the main module)
or you don't and
-------a COMMIT or ROLLBACK will be invoked by whatever is running the COBOL EXEC,
when the RUN UNIT/THREAD/TASK ends.
which is when all GOBACKs or a STOP RUN have been executed.
as far as the db2 flow (unit-of-work) is concerned,
the effect of the COBOL code is the same as the final EXIT (implicit or explicit )
of a PERFORM.
A GOBACK of a COBOL program is only a bunch of IFs and BRs (GO TOs)
if the returned-to program is part of the operating-system that invoked the mainmodule,
then we enter into the clean-up phase of the 'executor'
(i think that is what it is called )
part of ops-sys and when the detach to db2 (task disconnect) is made,
db2 checks for outstanding commits,
depending upon db2 bind parms, db2 either issues a COMMIT or ROLLBACK,
which will release all memory, dasd and whatever else db2 has claimed for the last unit-or-work for the task.