You are here: LANSA for i User Guide > Appendix C. Technical Notes > The @@UPID Field in LANSA Created Files

The @@UPID Field in LANSA Created Files

Whenever a physical file is created and maintained by LANSA (rather than some OTHER system) it has an additional field placed into it. The field is called @@UPID and is defined as packed (7,0). It is always the last field in the file.

Field @@UPID is used by LANSA to automatically check for "crossed updates". The logic to do this is very simple:

When writing user application programs (in non-LANSA applications) to write new records or update existing records in database files created by LANSA the following is recommended:

1.Set @@UPID to 1 when writing new records.

2.Add 1 to @@UPID when updating an existing record.

This effectively emulates the logic automatically used in all LANSA functions.

Note: COBOL programs will not like the field name @@UPID.

To solve this problem, alter the data dictionary definition of field @@UPID so that it has an associated alias name acceptable to COBOL (unless this has already been done).

Force recreation of all database files (that do not already have the alias name included), and then in the COBOL programs, use the COPY DD option to ensure that where a field has an alias name, it is to be used in the program in preference to its real name.

Warning: The field @@UPID should not be used at 4GL level, except where you have received specific instructions from LANSA on how to use it.

Note: When a file contains BLOB or CLOB fields, @@UPID may be incremented multiple times for a single UPDATE command. This occurs once for the main file, and once for each BLOB or CLOB field included in the UPDATE command.

Also see

RESET_@@UPID Built-In Function in the Technical Reference Guide.

Triggers - Some Do's and Don'ts.