LOGOUT (begin transaction)

Top  Previous  Next


LOGOUT(timeout [, file, ... , file ] )


Initiates transaction processing.


A numeric constant or variable specifying the number of seconds to attempt to begin the transaction for a file before aborting the transaction and posting an error.


The label of a FILE declaration. There may be multiple file parameters, separated by commas, in the parameter list (up to 100). If no file is specified, all files in the transaction must have been previously named using PROP:Logout.

The LOGOUT statement initiates transaction processing for a specified set of files. All files in the transaction set must have the same file driver and must already be open.

LOGOUT informs the file driver that a transaction is beginning. The file driver then performs the actions necessary to that file system to initiate transaction processing for the specified set of files. For example, if the file system requires that the files be locked for transaction processing, LOGOUT automatically locks the files.

Only one LOGOUT transaction may be active at a time. A second LOGOUT statement without a prior COMMIT or ROLLBACK generates errorcode 56.

The behavior of LOGOUT is file driver dependent, especially with SQL based drivers. Please see the Supported Commands and Attributes section for more information on each driver. In general, a LOGOUT on SQL based files affects all files on a connection that is associated with a file in the logout list, If you do not want a particular table logged out, you must open it on a different connection by using a different OWNER string.


Errors Posted:


File Is Already Locked


File Not Open


Unable to Log Transaction


LOGOUT Already Active


Function Not Supported


LOGOUT(1,OrderHeader,OrderDetail) !Begin Transaction

DO ErrHandler                     !always check for errors

ADD(OrderHeader)                  !Add Parent record

DO ErrHandler                     !always check for errors

LOOP X# = 1 TO RECORDS(DetailQue) !Process stored detail records

 GET(DetailQue,X#)                !Get one from the QUEUE

 DO ErrHandler                    !always check for errors

 Det:Record = DetailQue           !Assign to record buffer

 ADD(OrderDetail)                 !and add it to the file

 DO ErrHandler                    !always check for errors


COMMIT                            !Terminate successful transaction



ErrHandler ROUTINE                 !Error routine

IF NOT ERRORCODE() THEN EXIT.     !Exit here if no error

Err" = ERROR()                    !else save the error message

ROLLBACK                          !Rollback the transaction


BEEP                              !Alert the user

MESSAGE('Transaction Error - ' & Err")

EXIT                              !and exit

See Also: