TMF Application Programmer's Guide (G06.24+)

TMF Programming Environment
HP NonStop TMF Application Programmer’s Guide522419-004
1-3
Initiating a Transaction
communications line failure during the cash withdrawal transaction, for example,
should negate the successful outcome of the two preceding fund transfer operations.
In this particular example, the situation is further complicated in that each of the
individual business operations results in the issuance of a printed receipt to the
customer upon successful completion of the operation. If the entire session were to be
backed out because of a line failure while processing the cash withdrawal, the
customer would possess two printed receipts indicating successful fund transfers that,
in fact, did not take place.
Completion Time
Occasionally, elapsed time is an issue to consider. If a transaction remains on the
system too long, TMF aborts it. In most application environments, individual
transactions exist for only a few seconds or minutes. In a very busy environment,
however, a transaction that exists for more than an hour is in real danger of being
aborted by TMF. This problem can be remedied somewhat at execution time by the
use of operator commands. A preferable solution, if at all possible, is to design your
transactions so they do not take too long to complete.
Initiating a Transaction
You initiate a TMF transaction by invoking the BEGINTRANSACTION procedure. The
following table summarizes the statements that you use to do so, in each of the
supported programming languages:
The BEGINTRANSACTION procedure generates a transaction identifier that uniquely
identifies each transaction. Thereafter, the transaction identifier is transparently affixed
to all database operations and interprocess communication performed within the
domain of the particular transaction.
Any program module can initiate a TMF transaction; within each module that does so,
however, you must always explicitly match every BEGINTRANSACTION call with a
corresponding call to ENDTRANSACTION or ABORTTRANSACTION. This is true
even if TMF or another process has already aborted the transaction.
Programming
Language
Statement Used for Invoking the BEGINTRANSACTION
Procedure
C, C++ status = BEGINTRANSACTION (trans-tag
);
COBOL85 ENTER “BEGINTRANSACTION” USING trans-tag GIVING
status
FORTRAN status = BEGINTRANSACTION (trans-tag
)
NonStop SQL/MP BEGIN WORK
Pascal status:= BEGINTRANSACTION (trans-tag
)
SCREEN COBOL BEGINTRANSACTION
TAL status:= BEGINTRANSACTION (trans-tag
);