Introduction to the Exchange module

You use the Exchange module to import and export data to and from LN.

The Exchange module is mainly used for:

  • Repetitive data replication for multisite environment
  • Repetitive data replication for linking LN software to other software applications
  • Data conversions from one version of LN to another
  • Data conversions from other software to LN software the Exchange module controls the data export from LN tables to ASCII files and vice versa. You can also use the Exchange module to perform a data export. The changes in the database during the export process read from the audit files and are written to ASCII files. These changes are replayed at the target database during the import process.

The Exchange module has facilities to:

  • Convert data
  • Conditionally insert update, and delete data
  • Control and monitor the process using log files the Exchange module is asynchronous and batch-oriented. The data exchange is performed by a batch process, which can be started manually or run based on a schedule that uses LN's job mechanism.

The Exchange module is divided into two major areas:

  • Export of data
  • Import of data

The Export module is used to create a sequential ASCII files filled with data from the LN database. The ASCII file can have its own format, which can be different from LN tables. You can also create the corresponding definition file. This file can be used to load the data definitions during the import procedure.

The Import module is used to read the sequential files created by the Export module or by any other data source. The data from these files is put into LN tables.

The principle of an exchange procedure.

You can define exchange schemes in the Master Data. Each exchange scheme has a unique code.

The exchange scheme has two major entities:

  • ASCII files (Data Dump)
  • Batches for conversion

ASCII Files

ASCII files and ASCII file fields form the first major part of an exchange scheme. They contain the records that will be exchanged. Every line in that file represents a record. A record can have a fixed field length or a length that is defined with a field separator.

Conditions can be used to manipulate the values of the ASCII files fields in the exchange process. They can be specified per exchange scheme. A condition is maintained using LN 3GL/4GL statements in the text editor. Various functions and variables are provided to simplify the condition text. After the condition is created, its syntax must be checked.

Batches

Batches are the entities that contain relationships between ASCII files and LN tables.

The relationships between the ASCII files and the LN tables are defined in table and field relationships. To import and export alike, you can specify these relationships per batch line.

Import of Data

Batches consist of table and field relations. The table relations for import specify which data of the ASCII file(s) will be transferred to which LN table. A one-to-many relation between LN tables and ASCII files is possible. Each entry forms a line in a batch. Conditions can also be linked to a table relation.

Four condition types can be defined:

  • Insert condition
  • Overwrite condition
  • Update condition
  • Delete condition

The corresponding action is only carried out if the return value of the conditions linked to the action is true.

For each relation table you can maintain relations at field level. These relations state which field in the ASCII file must fill a field in the LN table. A condition can also be linked at this level. The output of the condition is the value of the field.

Export of Data

In case of an export of data the table relations indicate which data from the LN tables must be transferred to which ASCII files. One ASCII file can import data from only one LN table, but exceptions can be made by using conditions. In that case, you can put data of related tables in the same ASCII file. Each entry forms a table relation for export. Relations on field level can be maintained per table relation. These relations define how each field in the ASCII file must be filled.

The standard bdbpre program can also be used to create ASCII files, but this can only be done if the structure of the ASCII file is identical to the data definition of the LN table, and the export is not based on audit.

the Exchange (XCH) module process

After the exchange scheme is created and the import or export program is generated, the exchange process can be carried out by starting one of the following sessions:

  • Import Data (Non-Regular) (daxch0223m000)
  • Import Data (on a Regular Basis) (daxch0224m000)
  • Export Data (Non-Regular) (daxch0233m000)
  • Export Data (on a Regular Basis) (daxch0234m000)

Every exchange scheme code represents a different scheme. For conversion of a standard package, for example an upgrade of LN, one exchange scheme can be provided. A new exchange scheme can be created to customize the exchange to specific needs. It is possible to copy the exchange scheme from one code to another and to modify the other to suit the requirements. By providing the concept of a parent exchange scheme, copying data can be restricted to only those parts that differ from the exchange scheme.