3 1 3 What Is an I O Module

LANSA for i

3.1.3 What Is an I/O Module?

I/O modules are RPG programs compiled by LANSA to:

  • Support all input and output operations to IBM i database files set up by LANSA.
  • Perform file and dictionary level validation rules against fields when adding, changing or deleting information in the files.
  • Set field default values when inserting new records into the file and the user has not supplied the field value.
  • Execute user defined RPG code to derive any virtual fields in the file definition.
  • Automatically maintain batch, control or summary totals in other files.
  • Perform data conversions if the data format requested (or supplied) by the user varies from the data format in the file.
  • Emulate file I/O operations not supported in the RPG language.
  • Provide database security.
  • Protect database integrity.
  • Provide consistent and easy to use error diagnostics.
  • Provide I/O support to the RDML commands used by LANSA.

The use of I/O modules within LANSA "insulates" compiled user defined processes from the database definition and provides some distinct advantages:

  • Centralization of validation rules logic. Dictionary and file level validation code is compiled into the I/O module and not repeated in every process that uses the file. Thus the validation rules can be changed without the need to recompile every process that accesses the file.
  • True data independence. A file can be changed without the need to recompile every process that uses the file. This includes changing the definition of existing fields in the file as well as adding new fields to the file.
  • Faster compiles of user defined processes because there is no direct reference to the external database definition.
  • Support for virtual fields. These fields, derived from "real" fields in the file, appear as if they are in the database file, even though they don't really exist.