You are here: LANSA for i User Guide > 5. Housekeeping > 5.12 Exporting and Importing > Define Substitution Variables Used in a List
Define Substitution Variables Used in a List

When the option to 'Define substitution variables used in list' is chosen from the Work with Export List Menu a screen similar to the following example is used to manipulate the export list:

 

 DC@P620011        Define Substitution Variables                       

                                                                       

                                                                       

 List       : TEST2   Export details in compiled form                  

                                                                       

 Variable  Substitution value / Default value       Prompt user    

   Name    Prompt text to display if prompt req  When importing  

 $$DTALIB$$ _______________________________________      Y          

 Specify library to which database files are to be imported  

                                                                       

 $$SYSNAM$$ _______________________________________      Y          

 Specify the 4 letter prefix/name of your system               

                                                                       

  _______  ________________________________________      _          

  ____________________________________________________

                                                                       

                                                                       

 Fnn=Help  Fnn=Exit  Fnn=Cancel  Fnn=Messages                          

                                                                      

 

 

A substitution value is a symbolic name that can be used:

Substitution variables are useful because they let the importing site specify what value should actually be used for some activity, rather than the exporting site having to know in advance and 'hard-code' into the export list what the value should be.

For example, an exporting site can indicate that a physical file should be imported into a library called QGPL. Thus the importer has no chance to actually change the library name when importing the information in his/her system.

However, by using a substitution variable, the exporter can indicate that the file should be imported into a 'variable' library called $$DTALIB$$. When the job is run, LANSA will ask the importer what value should actually be used in place of variable $$DTALIB$$.

Substitution variables names always have the format:

$$XXXXXX$$

where XXXXXX is any set of non-blank letters or numbers.

Every export list contains one special substitution variable called $$DTALIB$$ which cannot be deleted. This is the default variable used by LANSA when importing file definitions into any system.

As many other variables as required can be defined within an export list provided that their names are unique within the list and they have the correct name format of $$XXXXXX$$.

An import job produces a report just like an export job does. All interactions with the importer, with regard to substitution variables, are recorded on the report.

By using the 'Define substitution variables in list' facility it is possible to:

To delete an existing variable, simply blank out/field exit over all details of the variable and press enter.

To define a new variable or alter an existing variable, enter/modify details as follows:

This example uses the shipped system variable *PARTDTALIB (Partition Data Library) as a default value for the substitution value. When this list is imported this system value will be set to the correct library name (e.g.: DC@MODLIB) and then the operator will be prompted with DC@MODLIB as the default reply because 'Prompt' is Y (yes).

 

Variable  Substitution value / Default value    Prompt user

  Name    Prompt text to display if prompt req  When importing  

 

$$DTALIB$$ *PARTDTALIB                                   Y  

 

Specify library into which database files are to be imported

 

 

 

 

However, this example uses the shipped system variable *PARTDTALIB, but specifies N (no) for 'Prompt'. This means that the substitution value will be set to the partition data library name and then the import will proceed without asking the operator to confirm this value.

Variable   Substitution value / Default value    Prompt user

  Name     Prompt text to display if prompt req  When importing  

 

$$DTALIB$$ *PARTDTALIB                                   N

 

Specify library into which database files are to be imported

 

 

 

Any shipped LANSA system variable that is evaluated by program M@SYSVAR, or any user defined system variable at all, can be used in this manner.

Only alphanumeric system variables up to a maximum length of 50 characters should be used this way.