Help/Systems SEQUEL Software PowerTech Skybot Software
Help/Systems
The World's Leader in IBM iSeries Software Solutions

OPAL techniques for advanced users

If you are involved in developing complex OPAL applications in Robot/CONSOLE, you should consider using the INTABLE and CALLCP operations.

The INTABLE operation performs comparisons on multiple variable values at the same time. It may allow you to replace repetitive IF/OR statements with a single INTABLE statement. This usually creates cleaner, easier-to-maintain OPAL code. In addition, OPAL tables can be shared among your various OPAL programs.

To use the INTABLE statement, you need to create an OPAL table. To access the OPAL Table object, go to the Message Set Menu and select Maintain OPAL Tables. Press function key 6 to create a table. Give it a name and description. After Robot/CONSOLE creates the table, enter a 2 next to the new table to add values to the table.

Tip: If you plan to do comparisons to the TEXT variable, make sure that the table entry matches the compare value exactly (upper/lower case, spaces, and so on).

In our example, we want to verify alignment on several printers. Our table values are a list of printers (PRT01, PRT02, and so forth). Now, create the message set to use this table. Before you learned about the INTABLE statement, you might have written some OPAL that looked like this:

Logic Operand Variable Operation Operation Value
IF VAR3 EQ PRT01
OR VAR3 EQ PRT02
OR VAR3 EQ PRT03
    ENTER G
END      

Now that you understand the power of OPAL tables and the INTABLE statement, you can simplify your code to look like this:

Logic Operand Variable Operation Operation Value
IF VAR3 INTABLE PRINTER
    ENTER G
END      

As you can see, the OPAL table makes the OPAL code much easier to read, set up, and maintain as you add more variable values to check.

Another rarely used operation is CALLCP, which allows you to pass message data to a CL or RPG program you have written to perform recovery operations outside of Robot/CONSOLE. User programs can return a value to Robot/CONSOLE by using a data area, but cannot answer the message directly. If you use the CALLCP operation, make sure your program will notify someone to answer the message (if needed), code your OPAL to retrieve a data area value (or simply delay to give the program time to work), and then reply.

Contributed by Terri Preston, Technical Consultant