You are here: LANSA for i User Guide > 3. Files > 3.11 Fields in the File Definition > 3 11 1 Fields in File Definition Maintenance

3.11.1 Fields in File Definition Maintenance

This screen is displayed when:

 

 DC@P200501         Display Fields in File Definition                  

                                                                       

 File : XXXXXXXXXX XXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX ( XXX )

                                                                       

                                                        Primary        

  Seq   Name       Description                          Key order Src  

   10   NAMCDE     Name and address code                    1          

   20   NAME       Name of person/company/organisation                 

   30   ADDR1      Address line 1                                      

   40   ADDR2      Address line 2                                      

   50   ADDR3      Address line 3                                      

                                                                       

  Fnn=Help  Fnn=Exit  Fnn=Cancel  Fnn=Messages  Fnn=Change  Fnn=Delete 

                                                                       

 

 

Working from this screen you can:

Remember that field names can be specified in full, partially or chosen from the data dictionary (by entering a "?").

WARNING: Before deleting fields from a file, print the file definition report. Other files may use fields in this file as the source for Predetermined Join Fields or for batch control. These other files will not compile if the required fields are deleted from this definition.

Input Options

The following input options apply when specifying the fields in a file definition:

Seq

Specifies the sequence/order of the field relative to other fields in the file. Use numbers in the range 1 to 99999 to indicate the order that fields should be included into the file record format.

Fields are ordered from low to high by sequence when they are placed in the file record format. When no sequence number is specified, sequence number 99999 is assumed. When fields are assigned the same sequence number they are sub-ordered by the order in which they are specified on the screen.

Field Name

Specifies the name of a field that is to be included in the file definition. Any field used in a file definition must be defined in the LANSA data dictionary before it can be included in a file definition.

By entering a partial name or "?", or by entering a sequence number or key sequence and blank field name, the multiple field selection screen will be displayed. The list of fields is built from the LANSA data dictionary. It allows up to 30 fields at a time to be added to the file definition. The sequence number used in the working list will be used to insert the selected names into the definition. Refer to prior section, 3.10.1 Select Fields When Working from File Definition Menu for more details.

The complete list of all fields in the file definition form the file record. There is no effective limit to the number of fields that can be included in a file definition. However the net length of a file record (calculated by adding together the byte lengths of all fields in the file definition) should not exceed 9996 bytes. This is one of the LANSA restrictions.

LANSA automatically includes one field into every file it creates. The field is called @@UPID and is used by the LANSA database I/O modules to check for "crossed updates". Although this field is defined in the LANSA data dictionary it should NEVER be manually included into a file definition. See The @@UPID Field in LANSA Created Files for more details regarding the use of this field by LANSA.

Primary Key Order

Specifies the field(s) that form the primary key of the file. Fields are indicated as being part of the primary key by the entry of a number beside them in the "Primary key order" column. In addition the number specifies the order / hierarchy of the primary key.

Fields that form the primary key of the file should be numbered from 1 (first key in hierarchy / most significant key) to "n" (last key in the hierarchy / least significant key).

Note that the fields do NOT have to be defined into the file in primary key order. Nor do primary key fields have to be defined one after another. Primary keys are identified by a number and ordered by the relative sequence of the number.

The primary key of a file (which is composed of all the fields in the key concatenated in the order specified) must be UNIQUE. No more than one record in a file can have any given primary key. This rule is enforced by features in the operating system (DDS keyword UNIQUE) and can never be violated. Attempting to add a record to a file with the same primary key as a record already in the file will result in a "duplicate key error". LANSA automatically handles duplicate key errors and there is no need for user logic to handle or check for them.

The existence of a unique primary key is important to LANSA because it uniquely identifies one and only one record in a file.

There is no requirement to specify a primary key when setting up a file definition, but is strongly recommended that each and every file defined under LANSA has a unique/primary key.

Src

Indicates the "source" of the field definition when reviewing the definition of a field within a file. Normally this field is blank indicating that details of the field were input manually or loaded from an external (OTHER) file definition.

If a value appears in this field it indicates that the details of the field were input via the LANSA Built-In Function called FILE_FIELD. Refer to the Technical Reference Guide for more details of this (and other) Built-In Functions that allow file definitions to be created and edited directly from RDML programs. The value shown in this field is identical to the "source" argument given to the START_FILE_EDIT Built-In Function when automatic editing of this file definition was performed.