User Tools

Site Tools


prop_logout.htm
Navigation:  Language Reference > App C - PROP: Runtime Properties > Runtime VIEW and FILE Properties >====== PROP:Logout ====== Previous pageReturn to chapter overviewNext page

Property of a FILE that assigns or returns the priority level of the referenced FILE within a transaction. PROP:Logout may be used to build the list of files in the transaction before issuing the LOGOUT(seconds) statement to begin the transaction. By using PROP:Logout, you can add more files to the transaction than the limited number of parameters the LOGOUT statement will allow. If the LOGOUT statement lists any files at all, all files previously set for the transaction by PROP:Logout are removed from the transaction and only the files listed in the LOGOUT statement are logged out.

The priority level indicates the order in which the file is logged out in the transaction, with lower numbers being logged out before the higher numbers. If two files have the same priority level, they are logged out in the order in which they were added to the logout list. Assigning a positive priority level adds the FILE to the transaction, assigning a negative priority level removes the FILE from the transaction, and assigning zero (0) has no effect. Querying PROP:Logout returns the priority level assigned to the file, and zero (0) if the file is not a part of the transaction.

Attempting to use PROP:Logout to add a file to the transaction which uses a different file driver will result in ERRORCODE 48, “Unable to log transaction.”

Example:

Customer FILE,DRIVER('TopSpeed')
Record    RECORD
CustNumber  LONG
Name        STRING(20)
         END
        END
 
Orders  FILE,DRIVER('TopSpeed')
Record   RECORD
CustNumber  LONG
OrderNumber LONG
OrderDate   LONG
        END
       END
Items   FILE,DRIVER('TopSpeed')
Record   RECORD
OrderNumber  LONG
ItemNumber   LONG
        END
       END      
CODE
Customer{PROP:Logout} = 1    !Add Customer file to logout list and set priority to 1
Items{PROP:Logout} = 2       !Add Items file to logout list and set priority to 2
Orders{PROP:Logout} = 1      !Add Orders file to logout list and set priority to 1
X# = Items{PROP:Logout}      !Return Items file priority level (X# = 2)
Customer{PROP:Logout} = -1   !Remove Customer file from logout list
LOGOUT(1)                    !Begin transaction and
                            ! logout files in this order: Orders, Items
                            ! AND clear the logout list
X# = Items{PROP:Logout}      !Returns 0 because LOGOUT statement cleared the logout list.
Items{PROP:Logout} = 1       !Add Items to logout list (now there is one table in list)
COMMIT                       !Terminate the transaction
Orders{PROP:Logout} = 1      !Add Orders as well (now there are 2 tables on the list)
LOGOUT(1)                    !Logout Items and Orders tables, and clear the list
COMMIT                       !Terminate the transaction
prop_logout.htm.txt · Last modified: 2021/04/15 15:57 (external edit)