Ends a transaction by attempting to commit it, and returns the outcome of the transaction. Format SYS$END_TRANS [efn] ,[flags] ,iosb [,[astadr] ,[astprm] ,[tid]] C Prototype int sys$end_trans (unsigned int efn, unsigned int flags, struct _iosb *iosb,...);
1 – Arguments
efn OpenVMS usage:ef_number type: longword (unsigned) access: read only mechanism: by value Number of the event flag that is set when the service completes. If this argument is omitted, event flag 0 is used. flags OpenVMS usage:mask_longword type: longword (unsigned) access: read only mechanism: by value Flags specifying options for the service. The flags argument is a longword bit mask in which each bit corresponds to an option flag. The $DDTMDEF macro defines symbolic names for these option flags, which are defined in $END_TRANS Option Flags. All undefined bits must be 0. If this argument is omitted, no flag is set. Table SYS-15 $END_TRANS Option Flags Flag Description DDTM$M_SYNC Set this flag to specify that successful synchronous completion is to be indicated by returning SS$_SYNCH. When SS$_SYNCH is returned, the asynchronous system trap (AST) routine is not called, the event flag is not set, and the I/O status block is not filled in. DDTM$M_ Indicates that the service should return to the NOWAIT caller without waiting for final cleanup. Note that $END_TRANSW with the DDTM$M_NOWAIT flag set is not equivalent to $END_TRANS. The former does not return until the operation has been initiated, while $END_TRANS returns when the operation has been queued. The full range of status values may be returned from a nowait call. iosb OpenVMS usage:io_status_block type: quadword (unsigned) access: write only mechanism: by reference I/O status block in which the following information is returned contains: o The completion status of the service. This is returned as a condition value. o The outcome of the transaction. If the service returns SS$_ NORMAL, the outcome of the transaction is commit. If the service returns SS$_ABORT, the outcome of the transaction is abort. o An abort reason code that gives one reason why the transaction aborted, if the completion status of the service is SS$_ABORT. The $DDTMMSGDEF macro defines symbolic names for these abort reason codes, which are described in Abort Reason Codes: Table SYS-16 Abort Reason Codes Symbolic Name Description DDTM$_ABORTED The application aborted the transaction. DDTM$_COMM_FAIL A communications link failed. DDTM$_INTEGRITY A resource manager integrity constraint check failed. DDTM$_LOG_FAIL A write operation to the transaction log failed. DDTM$_ORPHAN_ Unauthorized branch caused failure. BRANCH DDTM$_PART_SERIAL A resource manager serialization check failed. DDTM$_PART_TIMEOUT The timeout specified by a resource manager expired. DDTM$_SEG_FAIL A process or image terminated. DDTM$_ A DECdtm transaction manager serialization SERIALIZATION check failed. DDTM$_SYNC_FAIL The transaction was not globally synchronized (an authorized branch had not been added). DDTM$_TIMEOUT The timeout specified on $START_TRANS expired. DDTM$_UNKNOWN The reason is unknown. DDTM$_VETOED A resource manager was unable to commit the transaction. Refer to the VSI OpenVMS System Services Reference Manual to view the structure of the I/O status block. astadr OpenVMS usage:ast_procedure type: procedure entry mask access: call without stack unwinding mechanism: by reference AST routine that is executed when the service completes if SS$_ NORMAL is returned in R0. The astadr argument is the address of this routine. The routine is executed in the access mode of the caller. astprm OpenVMS usage:user_arg type: longword (unsigned) access: read only mechanism: by value AST parameter that is passed to the AST routine specified by the astadr argument. tid OpenVMS usage:trans_id type: octaword (unsigned) access: read only mechanism: by reference Identifier (TID) of the transaction to be ended. If this argument is omitted, $END_TRANS ends the default transaction of the calling process.