Abort

Syntax

ABORT [ literal [ literal | object_name ] ]

Parameters

In MCP systems, this cannot be a national string.

Description

The Abort logic command terminates current transactions and restores the database.

To enable the Abort logic command to roll back the Glb.Work built-in segment attribute, set the segment's Preserve Session Data property to true.

If a message literal is not specified, the message (which might be translated), "ABORTED: System commanded Abort of this transaction" is displayed.

Abort and ispecs

The following issues are encountered while using the Abort logic command in ispec methods:

If an identifier is specified:

Abort and reports

The following are encountered while using the Abort logic command in report methods:

Abort when application is an OLTP Server

When processing an OLTP-originated transaction, the Abort command aborts the local transaction processing, rolls back any changes made to the local database, and notifies the client system of the failure.

The behavior of the database rollback process depends on the setting of Two phase commit (2PC) in your application, and whether any descendent transactions are part of a Global transaction that includes the aborting server. The term descendent transaction refers to a further OLTP transaction initiated by the server (as a client).

For descendent transactions:

For the client of the aborting server:

Abort when Application is an OLTP Client

The Abort command aborts the local transaction processing, and roll back any changes made to the local database.

If the local transaction initiated an OLTP global transaction, a rollback (TXROLLBACK) is performed, and any descendent 2PC OLTP transactions are also aborted and rolled out of their local databases.

Descendent non-2PC OLTP transactions are not aborted or rolled back. Completed non-2PC transactions are retained, even though their parent transaction has been aborted.

Non-OLTP Automatic Entries continue to function as in previous releases. Abort and rollback depend on whether or not you used 2PC with the transactions:

Abort in Messenger Cycle

When an Abort command is executed in a Messenger Cycle the transaction is aborted and any database updates performed in the transaction prior to executing the Abort command are rolled back.

Abort command has a variant, with an optional clause to specify the name of the Ispec to be recalled after aborting the current Ispec. This does not apply for Messenger cycle, and hence if the additional clause is specified, it would be ignored.

Examples

Example 1

This example aborts the transaction and displays the message "Error 1 encountered" if Error1 has the value "Yes".

If Error1 = "Yes"
	     Abort "Error1 encountered"
EndExit

Example 2

This example aborts the transaction, displays the default message, and recalls the Errs ispec if Error2 has the value "Yes".

Note: When recalling an ispec and also using the default message, an additional set of inverted commas containing at least one space character is required, preceding the ispec identifier.

If (Error2 = "Yes") 
       Abort " " Errs 
EndExit

Example 3

This example aborts the transaction in a Messenger Cycle, rolls back the database update performed in the transaction, and displays the message "Abort in Messenger".

Determine Actual PersistentClass
		   persistentClass.StringData := "thisData"
		   persistentClass.Update()
End
Abort "Abort in Messenger"