When the option to 'Define IBM i command to execute before/after import' is chosen from the Work with Export List Menu a screen similar to the following example is used to manipulate the export list:
Since the LANSA export/import facilities support the transfer of non-LANSA objects between systems, a method by which user defined IBM i operating system commands can be executed as part of the import job is also required.
To define an operating system command as part of the export list the following information must be specified:
1. When the command is to be executed (before or after the import run).
2. The order that the command is to be executed in (relative to any other commands specified).
3. What should happen if an error is detected when the command is executed.
4. The command that is to be executed. The format of the command varies according to the type of machine the export list is being prepared on and the ultimate destination of the exported data.
An import job produces a report just like an export job does. All user-defined commands executed are recorded on the report, including any error message details resulting from the command.
By using the Define IBM i command to execute before/after import facility it is possible to:
To delete an existing command, simply blank out/field exit over all details of the command and press enter.
To define a new command or alter an existing command, enter/modify details according to the following:
The Execute Bef/Aft field is used to specify when the command is to be executed. It must be either B (before import) or A (after import).
The Sequence Number field is used to specify when the command should be executed relative to other commands in the same before or after group. When inserting new commands use integer sequence numbers like 1, 2, 3,etc. This will allow the later insertion of any missing commands by using sequence numbers like 1.2, 2.04, etc.
The Ignore Error field is used to indicate what should happen if an error is detected when actually executing the command. Specify Y if any errors are to be ignored and the next command executed. Enter N if the errors are not to be ignored. When an error occurs, and it is not ignored, the import job will fail with fatal errors.
The IBM i command field allows the specification of the actual command to be executed. After the command has been specified it is checked for syntax via the IBM supplied program QCMDCHK.
Because the IBM supplied syntax checker programs are used, it is also possible to prompt commands when they are being defined.
To do this, precede the command to be used by a question mark (?) and press enter. A standard operating system command prompt will result. Fill in all required parameters and press enter again. The final version of your command will then be re-displayed.
This feature can also be used to 're-prompt' existing commands. Simply insert a question mark before the command and press enter.
Remember that any command can also contain substitution variables. The method of defining the use of substitution variables in export lists is described in Define Substitution Variables Used in a List.
When substitution variables are actually replaced in a command just prior to execution, trailing blanks in the substitution value are stripped off. For example, if a command used a substitution variable called $$PGMLIB$$, and a command defined to execute before import looked like this:
and at execution time variable $$PGMLIB$$ contained 'QGPL', then the command actually executed would look like this:
Similarly a command to be executed may actually be expanded if the substitution variable's value is actually longer than the space used by the substitution variable within the command string. For example, consider the command:
SNDMSG MSG('$$USRMSG$$') TOMSGQ($$MSGQUE$$)
If at execution time $$USRMSG$$ contained 'HELLO THERE, HOW ARE YOU' and $$MSGQUE$$ contained 'WS1', then the actual command executed would be:
SNDMSG MSG('HELLO THERE, HOW ARE YOU') TOMSGQ(WS1)