The STARTTRAN/ENDTRAN Intrinsics [ HP SPT/XL User's Manual: Collection Software ] MPE/iX 5.0 Documentation
HP SPT/XL User's Manual: Collection Software
Appendix B The STARTTRAN/ENDTRAN Intrinsics
STARTTRAN/ENDTRAN intrinsics
Calls to the intrinsics STARTTRAN/ENDTRAN may be embedded in your
application code to delimit logical transactions for the purpose of
analysis using HP SPT/XL.
You can instruct the HP SPT/XL analyzer to use these intrinsics as
delimiters of transactions (See HP SPT/XL User's Manual: Analysis
Software chapter 3 "Defining Logical Transactions").
About STARTTRAN/ENDTRAN:
* STARTTRAN/ENDTRAN must be defined as or called intrinsics in your
program. If they are entered in lower case letters and not defined
as intrinsics, you will see the message undefined external when you
attempt to run your program.
* STARTTRAN/ENDTRAN intrinsic calls are passive if a program is not
being monitored using HP SPT/XL.
* The transaction name you assign with STARTTRAN/ENDTRAN can be up to
32 characters long. The name ends with the first space or semicolon
(;) in the string or at 32 characters.
STARTTRAN Marks the beginning of a transaction.
Syntax I32 I32 CA I32
status:= STARTTRAN(trantype, tranname, tranid);
Use The STARTTRAN intrinsic lets you define the beginning of a
transaction independently of other intrinsics your program
may be calling. If HP SPT/XL is monitoring a process which
calls STARTTRAN, calls to STARTTRAN are added to a list of
events which could begin transactions. If HP SPT/XL is not
monitoring a process which calls STARTTRAN, calls to
STARTTRAN return to the calling process immediately.
Functional
Return
status 32-bit signed integer (assigned functional return).
Returns status in the form of a signed integer. Currently
zero is always returned (there are no possible errors).
Parameters
trantype 32-bit signed integer. A number which identifies the type
of transaction which the call to STARTTRAN will mark the
beginning.
tranname Character array (optional). A string of characters which
identifies the kind of transaction the call to STARTTRAN
will mark the beginning. Tranname may be up to 32
characters long and is terminated with a space or a
semicolon.
tranid 32-bit signed integer (optional). Reserved for future use.
NOTE HP SPT/XL uses the trantype and tranname parameters to build an
identifying string for a transaction. For example: if trantype is
"3" and tranname is "ORDER_ENTRY_TRAN", HP SPT/XL will construct
the string "ORDER_ENTRY_TRAN (3)" to identify all transactions
which this call to STARTTRAN marks the beginning. Changing either
parameter will result in a different transaction name.
ENDTRAN Marks the "end" of a transaction.
Syntax I32 I32 CA I32
status := ENDTRAN(trantype, tranname, tranid);
Use The ENDTRAN intrinsic lets you define the "end" of a
transaction independently of other intrinsics your program
may be calling. If HP SPT/XL is monitoring a process which
calls ENDTRAN, calls to ENDTRAN are added to a list of
events which could begin transactions. If HP SPT/XL is not
monitoring a process which calls ENDTRAN, calls to ENDTRAN
return to the calling process immediately.
NOTE HP SPT/XL treats a call to ENTRAN exactly as it treats a call to
the STARTTRAN intrinsic. HP SPT/XL considers transactions to run
from an event which begins a transaction to another event which
begins a transaction. ENDTRAN, like STARTTRAN is an event which
could begin a transaction.
Functional
Return
status 32-bit signed integer (assigned functional return).
Returns status in the form of a signed integer. Currently
zero is always returned (there are no possible errors).
Parameters
trantype 32-bit signed integer. A number which identifies the type
of transaction which the call to ENDTRAN will mark the
"end".
tranname Character array (optional). A string of characters which
identifies the kind of transaction the call to ENDTRAN will
mark the "end". Tranname may be up to 32 characters long
and is terminated with a space or a semicolon.
tranid 32-bit signed integer (optional). Reserved for future use.
NOTE HP SPT/XL uses the trantype and tranname parameters to build an
identifying string for a transaction. For example: if trantype is
"3" and tranname is "ORDER_ENTRY_TRAN", HP SPT/XL will construct
the string "ORDER_ENTRY_TRAN (3)" to identify all transactions
which this call to ENDTRAN marks the beginning. Changing either
parameter will result in a different transaction name.
This is an example in COBOL.
WORKING-STORAGE SECTION.
...
77 TRAN-TYPE PIC S9(8) COMP.
77 TRAN-NAME PIC X(32).
77 TRAN-ID PIC S9(8) COMP.
77 TRAN-STATUS PIC S9(8) COMP.
...
PROCEDURE DIVISION.
...
MOVE 2 TO TRAN-TYPE.
MOVE "Process_Order_Line" TO TRAN-NAME.
CALL INTRINSIC "STARTTRAN" USING TRAN-TYPE,
TRAN-NAME,
TRAN-ID
GIVING TRAN-STATUS.
IF TRAN-STATUS <> 0 THEN
...
MOVE 2 TO TRAN-TYPE.
MOVE "Process_Order_Line" TO TRAN-NAME.
CALL INTRINSIC "ENDTRAN" USING TRAN-TYPE,
TRAN_NAME,
TRAN-ID
GIVING TRAN-STATUS.
The HP SPT/XL analyzer would identify the transaction types as follows:
'PROCESS_ORDER_LINE (2)' and
Processing after 'PROCESS_ORDER_LINE (2)'
This is an example in PASCAL.
Intrinsic declarations
function starttran:integer;intrinsic;
function endtran :integer;intrinsic;
...
Procedure for indicating the start of a transaction
procedure start_transaction(transaction_type : integer);
begin
if define_tranx then
begin
case transaction_type of
start_order_tran:
begin
tran_name:='Start_Order ';
end;
process_ordline_tran:
begin
tran_name:='Process_Order_Line ';
end;
complete_order_tran:
begin
tran_name:='Complete_Order ';
end;
end;
tran_type:=transaction_type;
tran_stat:=starttran(tran_type,tran_name,tran_id);
if tran_stat<>0 then...
end;
end;
Procedure for indicating the end of a transaction
procedure end_transaction(transaction_type : integer);
begin
if define_tranx then
begin
tran_type:=transaction_type;
tran_stat:=endtran(tran_type);
if tran_stat<>0 then...
end;
end;
MPE/iX 5.0 Documentation