3 1 What Is a File and What Is a File Definition

LANSA for i

3.1 What Is a File and What Is a File Definition?

The file control component of LANSA works with file definitions.

It is important that the concept of a file definition and how it relates to the IBM i concept of a file be understood before attempting to use the file control components of LANSA.

A file is a normal IBM i database file in which records can be retrieved, added, changed or deleted. A file may be a physical file or a logical view / file.

To create a file LANSA uses a file definition.

In IBM i terms a file definition contains:

  • The fields that make up the format of the file records.
  • Logical views of the file that are required. The logical views may contain select/omit criteria.

In addition the LANSA file definition may also contain:

  • Validation rules that are to be performed on fields when records are added, updated or deleted.
  • Access routes from the current file to other files in the system. This facility allows users to access a complete database without having a detailed knowledge of its structure.
  • Predetermined join fields which use the current file's access routes to retrieve information from related files.
  • Virtual field definitions. These are fields that are not actually present in the database file but are "derived" from fields that are in it. Hence the name "virtual". These fields appear as if they are in the file, even though they aren't.
  • Batch control logic which specifies other files in the system that contain batch, control or summary totals of information in the current file. LANSA will ensure that the summary or control information in other files is automatically maintained.

Some points to note about working with file definitions are:

  • The file definition name and actual physical file name are always the same. When LANSA requests that the name of a file definition be supplied, specify the name of the physical file (as opposed to the name of any associated logical views/ files).
  • The preceding point applies particularly when adding or amending logical views / files. When the option to "Review or change a file definition" is chosen from the file control menu, LANSA will request that the name of the file definition to be review / change be specified. Specify the name of the physical file (which is always the same as the file definition) rather than the name of the logical view / file. Once the correct file definition has been chosen options on the file definition menu allow the addition, review or change of the associated logical files.
  • To emphasize these two preceding items again. Within the LANSA system logical views / files are considered to be part of the file definition. The file definition contains the attributes of the associated physical file and all associated logical views / files. The file definition name and the associated physical file name are one and the same.