IBM BPM, V8.0.1, All platforms > Authoring services in Integration Designer > Services and service-related functions > Access external services with adapters > Configure and using adapters > IBM WebSphere Adapters > IBM i > Overview of WebSphere Adapter for IBM i > Technical overview > Outbound processing > Supported object types > Call IBM i programs

Pre IBM i and post IBM i commands

Pre IBM i and post IBM i commands or library list is a system object that serves as a directory to other objects. IBM i adapter uses the PCML standard to help customers directly call program (RPG or COBOL) or service program (SRVPGM) on the target IBM i machine without any special coding.

A call to run an IBM i program such as RPG, COBOL, or SRVPGM program requires reference to other dependent IBM i programs such as RPG, COBOL, or SRVPGM program and database files. These files could be present in the same or different libraries (folders) on same IBM i machine. In order to support referring files and objects in different locations, you can configure the pre IBM i commands and post IBM i commands as per your requirement. Pre IBM i commands are commands that you run before the program execution. Post IBM i commands are commands that you run after the program execution. You can choose to add any number of pre IBM i commands and post IBM i commands.


Configure the library list

To configure the library list, you need to understand the structure of the data in the database and know what database objects the module needs to access. In addition, you need to know the following information:


Add Library List Entry and Remove Library List Entry command

In order to support referring files and objects in different locations, you can add the location of the library to the current library list before executing the PRG program using the Add Library List Entry ADDLIBLE command. After executing the program, you need to remove these newly added entries from the current library list using the Remove Library List Entry RMVLIBLE command. For a detailed explanation of ADDLIBLE, see documentation at http://publib.boulder.ibm.com/iseries/v5r1/ic2924/index.htm?info/cl/addlible.htm


Library list example

The following example provides more information about using the ADDLIBLE command to configure the pre commands and post commands for RPG execution.


Example: Consider the RPG program name ABC.RPG and the PCML for this program is ABC.PCML. After executing the EMD wizard, the business object file for this PGM is generated as ABC.XSD. Also, considering ABC.PGM as call to object which is in another library LIBINFO and considering there is a dependency on this file. This command adds the library LIBINFO to the end of the user portion of the library list. You can edit this file and update the changes in it. For more details, see the annotation provided in this example. The ADDLIBLE command is used to add libraries to the current library list. You can choose to add any number of pre commands and post commands. The attribute stoponerror can identify when a command fails and throws ErrorCompletingRequestException.

<appinfo source="http://www.ibm.com/xmlns/prod/websphere/j2ca/ibmi/metadata">
<ibmiasi:IBMiObjectLevelMetadata
xmlns:ibmiasi="http://www.ibm.com/xmlns/prod/websphere/j2ca/ibmi/metadata">
<ibmiasi:precommands>
         <command>
                 <ibmiasi:commandstring>ADDLIBLE LIBINFO *FIRST</ibmiasi:commandstring>
                 <ibmiasi:stoponerror>false</ibmiasi:stoponerror>
         </command>
<command>
                  <ibmiasi:commandstring>ADDLIBLE LIBINFO *FIRST</ibmiasi:commandstring>
                 <ibmiasi:stoponerror>true</ibmiasi:stoponerror>
         </command>
</ibmiasi:precommands>
<ibmiasi:postcommands>
         <command>
                 <ibmiasi:commandstring>RMVLIBLE CREDITINFO</ibmiasi:commandstring>
                 <ibmiasi:stoponerror>false</ibmiasi:stoponerror>
         </command>
</ibmiasi:postcommands>
</ibmiasi:IBMiObjectLevelMetadata
</appinfo>

Call IBM i programs