IBM Support

Program Messaging with the Remote Command Host Server and the IBM Toolbox for Java Driver

Troubleshooting


Problem

This document will discuss how the return of program messages are handled by IBM Toolbox for Java and the Remote Command Host Server.

Resolving The Problem

In the IBM Toolbox for Java, there are different ways to execute a program remotely using the Remote Command Host Server.

1.

The first method is the use of the CommandCall class

With this class, the remote command host server will return all messages produced from the command call regardless of their message type. This includes *INFO, *INQ, *RQS, *COMP, *DIAG, *NOTIFY, *ESCAPE, and *STATUS message types. The client would then create an instance of the AS400Message class and call the getMessageList() method on the command object to retrieve the messages as in the example below:
// Get the message list which contains the result of the command.
    AS400Message[] messageList = cmd.getMessageList();
2. The second method is the use of the ProgramCall class

With this class, the remote command host server will only return messages if an *ESCAPE message is thrown. The remote command host server only knows that a remote program call failed if the program signals an escape message. If no escape message is signaled, then the remote command server believes the request was successful, and it does not search for any messages. If an escape message is signaled, then messages are retrieved and returned. All previous messages regardless of type occurring before the escape message will be returned along with the escape message.

Currently, there is no way to return message types other than an escape message if the program completes successfully. If you would like to return *INFO, *DIAG, and *COMP message types, it is recommended that the IBM Toolbox CommandCall Access class be used instead.
 
// Run the program. My program has
    // no parms. If it fails to run, the failure is returned as a set of messages in the message list.
    if (pgm.run() != true)
    {
       // If you get here, the program
       // failed to run. Get the list of
       // messages to determine why the
       // program didn't run.
       AS400Message[] messageList = pgm.getMessageList();

[{"Type":"MASTER","Line of Business":{"code":"LOB68","label":"Power HW"},"Business Unit":{"code":"BU070","label":"IBM Infrastructure"},"Product":{"code":"SWG60","label":"IBM i"},"ARM Category":[{"code":"a8m0z0000000CS8AAM","label":"Host Servers-\u003ERemote Command"}],"ARM Case Number":"","Platform":[{"code":"PF012","label":"IBM i"}],"Version":"6.1.0;7.1.0;7.2.0;7.3.0;7.4.0;7.5.0;7.6.0"}]

Historical Number

581093286

Document Information

Modified date:
09 May 2025

UID

nas8N1011875