The Advanced, utilities workflow component,
IBM i Call Program enables the possibility to call a program on the IBM i (even if InterformNG2 is running on Windows). This workflow component should be used instead of the older alternative,
Execute native OS Command.
Prerequisite: You need a connection to the IBM i, which is setup in the
global system settings. The program will run as the user, that has been setup for the connection.
The IBM i Call Program component has these parameters:
In total it is possible to define up to 10 input text parameters (each of 128 characters), and the program can return up to 10 return text parameters (each of 255 characters).
Note: The program must be defined with all 20 parameters of the specified lengths.
The parameters are:
Exit program
The name of the program object on the IBM i, that you want to call.
Exit program library
The library in which the program is stored.
Input text 1... 10
These are the up to 10 input parameters for the program call. The maximum length of each parameter is 128 characters.
The program, that you call should be built like the program source below:
(The program must have the parameter list to match this format i.e. 10 entry parameters, that are each 128 characters followed by 10 return parameters, that are each 255 characters).
PGM PARM(&PARM01 &PARM02 &PARM03 &PARM04 &PARM05 +
&PARM06 &PARM07 &PARM08 &PARM09 &PARM10 +
&EXIT01 &EXIT02 &EXIT03 &EXIT04 &EXIT05 +
&EXIT06 &EXIT07 &EXIT08 &EXIT09 &EXIT10)
DCL VAR(&PARM01) TYPE(*CHAR) LEN(128)
DCL VAR(&PARM02) TYPE(*CHAR) LEN(128)
DCL VAR(&PARM03) TYPE(*CHAR) LEN(128)
DCL VAR(&PARM04) TYPE(*CHAR) LEN(128)
DCL VAR(&PARM05) TYPE(*CHAR) LEN(128)
DCL VAR(&PARM06) TYPE(*CHAR) LEN(128)
DCL VAR(&PARM07) TYPE(*CHAR) LEN(128)
DCL VAR(&PARM08) TYPE(*CHAR) LEN(128)
DCL VAR(&PARM09) TYPE(*CHAR) LEN(128)
DCL VAR(&PARM10) TYPE(*CHAR) LEN(128)
DCL VAR(&RETURN01) TYPE(*CHAR) LEN(255)
DCL VAR(&RETURN02) TYPE(*CHAR) LEN(255)
DCL VAR(&RETURN03) TYPE(*CHAR) LEN(255)
DCL VAR(&RETURN04) TYPE(*CHAR) LEN(255)
DCL VAR(&RETURN05) TYPE(*CHAR) LEN(255)
DCL VAR(&RETURN06) TYPE(*CHAR) LEN(255)
DCL VAR(&RETURN07) TYPE(*CHAR) LEN(255)
DCL VAR(&RETURN08) TYPE(*CHAR) LEN(255)
DCL VAR(&RETURN09) TYPE(*CHAR) LEN(255)
DCL VAR(&RETURN10) TYPE(*CHAR) LEN(255)
CHGVAR VAR(&RETURN01) VALUE('
myemail@mydomain.com')
ENDPGM
The program source above always simply return the text '
myemail@mydomain.com' in the first return variable.
After calling the IBM i program the initial payload will be overwritten with an XML structure containing the return variables. This XML structure looks like this:
<output>
<ReturnText01/>
<ReturnText02/>
<ReturnText03/>
<ReturnText04/>
<ReturnText05/>
<ReturnText06/>
<ReturnText07/>
<ReturnText08/>
<ReturnText09/>
<ReturnText10/>
</output>
Simple example of how a program can be called
The workflow below calls the program above and saves the result to the file system:
The IBM i Program Call looks like this:
Here the value '1001' is transferred as parameter 1 to the program.
The payload saved to a file and the file looks like this:
Here the value of the ReturnText01 can also be loaded in the workflow with the Xpath expression /output/ReturnText01