3 1 2 Variables

LANSA Composer

3.1.2 Variables

The Processing Sequence contains a pool of variables that may be used as parameters to Activities and Transformation Maps and may be tested and manipulated using Processing Sequence Directives.

Variables may be displayed and accessed using the Variables tab in the Processing sequence editor.

 

Some important points to note about Processing Sequence variables:

  • Variables implicitly become available in the variable pool when they are used or referenced as parameters or in Processing Sequence Directives. There is no explicit definition of variables in the Processing Sequence.
  • Variable names are not case-sensitive – for example &ftpconfig and &FTPCONFIG reference the same variable.
  • Variables are loosely-typed – it is the responsibility of the Activity and Processing Sequence designers to ensure that values in variables are appropriate for their intended use.
  • Variables may be used as "lists" simply by indexing references to them.  Refer to Lists for further information.

 

Variable Usage

Variables can be used to maintain state and to pass information from one Activity to a later Activity in the Processing Sequence. For example, the FTP_INBOUND shipped Activity returns a list of files retrieved by the FTP operation. This list may be used to control later Directives and Activities in the Processing Sequence.

Mostly, processing sequence variables are used to hold variable data that is used to orchestrate the process - for example, paths to transaction documents that are being processed.

It is less common that the processing sequence variables are used to hold application data items, such as the current order or customer number.  Most typically, this type of data is and should be processed by the Activities and Transformation maps used in the Processing Sequence and/or LANSA functions and/or Java or 3GL programs called by the Processing Sequence.

Sometimes, however, it is desirable or necessary to fill a processing sequence variable or variable lists with such application data items.  For example, after transforming a transaction document containing an in-coming sales order, it may be necessary that the Processing Sequence "know" an identifying key such as a batch or order number or the customer number, in order to pass it as a parameter to, say, a LANSA function that will further process the order.

There are several techniques available to accomplish this.  Some of the most common include:

  • using a transformation map, extract the required data from the transaction document file or from a database to a CSV (comma-separated variables) file
  • use the FOR_EACH_TXTLIN or FOR_EACH_CSVROW activities to read the contents of a text or CSV file
  • write a function, program or custom activity to extract and return the required information
  • on IBM i servers, you can use data areas and message queues to exchange information with other programs or processes using supplied activities such as GET_DTAARA and PUT_DTAARA or MSGQ_SEND and MSGQ_RECEIVE.

 

In addition, LANSA Composer defines an XML file format and provides activities for saving and loading processing sequence variables and for transforming application data to or from that file format.  For more information, refer to:

Save, Load and Transform Processing Sequence Variables