Share this page

# lr.end_sub_transaction

Marks the end of a sub-transaction.

    int lr.end_sub_transaction( String sub_transaction, int status );

Transaction Functions | Java Syntax

## Arguments

Name | Comments
--- | ---
sub_transaction | A string indicating the name of an existing sub-transaction.
status | The transaction status.

The lr.end_sub_transaction function marks the end of a sub-transaction. To mark the beginning of the sub-transaction, use the lr.start_sub_transaction function. You insert these functions immediately before and after the sub-transaction steps.

Multiple sub-transactions can be nested within a parent transaction, but each lr.end_sub_transaction statement must match an lr.start_sub_transaction statement or it will be interpreted as an illegal command.

## Return Values

This function returns 0 if it succeeds. It returns -1 if the transaction name is illegal or if there is no prior call to lr.start_transaction with a transaction of the same name.

## Parameterization

You cannot use standard parameterization for any arguments in this function.

## Example

In the following example,lr.start_sub_transaction and lr.end_sub_transaction create a transaction that performs purchases of six electrical items. The parent transaction is purchases and the sub-transaction is electrical_purchases.

    lr.start_transaction("purchases");

    /* Breakdown the transaction into a smaller transaction */
    lr.start_sub_transaction("electrical_purchases", "purchases");

    /* call to Server API */
    int status = purchase_electrical_items(6);

    /* End transaction with operation result - pass or fail */
    if (status == 0)
        lr.end_sub_transaction("electrical_purchases", lr.PASS);
    else
        lr.end_sub_transaction("electrical_purchases", lr.FAIL);
    lr.end_transaction("purchases", lr.AUTO);

Tips to improve your search results... VuGen Function Reference Version 26.1 Function Reference 26.1 All View Local Help Center View Online Help Center Version: