5.2.2 *AUTONUM and *AUTOALP System Variables (Data Areas)
IBM i data areas are emulated in an SQL table called LX_DTA in the LX_DTA collection.
Before attempting to execute applications that use *AUTONUM or *AUTOALP system variables and the data areas behind them, please note the following:
- *AUTONUM and *AUTOALP system variables will be automatically enrolled in the LX_DTA table when the first attempt is made to use one of them.
The data area locking/unlocking logic actually uses the LOCK_OBJECT and UNLOCK_OBJECT functions. A "Data area not found" error may leave the data area locked in the locking table. To remove this lock use a small function that uses the UNLOCK_OBJECT, or use a DBMS direct access tool to remove the lock row from table LX_FOL.
- Alternatively, *AUTONUM and *AUTOALP system variable data areas may be manually enrolled in the LX_DTA table. If you do this, always specify the library name as *LIBL. The data area name is derived from the *AUTOALP/*AUTONUM system variable name. For example, *AUTONUM07NXTPROD would be enrolled with the name NXTPROD.
Specify the data area type as "N" or "D" (numeric) for both *AUTONUM and *AUTOALP data areas. Even though the RDML level reference may be alpha (*AUTOALP), the actual data area behind the system variable is actually numeric.
- *AUTONUM/ALP values "roll over" when their maximum is reached (exactly as they do under IBM i). So *AUTONUM07NXTPROD rolls over after the value 9999999 is used.
Note: *DTAssslllxxxxxxxxxx, *AUTONUMnnxxxxxxxxxx and *AUTOALPnnxxxxxxxxxx system variable evaluation requests can be automatically diverted into a server system when locks are diverted into a server system. Refer to the DEFINE_ANY_SERVER Built-In Function description in the Technical Reference Guide for more information.