The message statement can be used for both output and input. It has a complicated set of "features" that are dependent upon the redirection state for both the unnamed input and unnamed output. Named streams cannot be used with the message statement since there is no syntax to pass the named stream as an input or output target. But the unnamed streams are deeply linked to the message statement, though the details are not clear from the documentation. Complicating this is the fact that the message statement is used on an implicit basis during error handling to display messages. These error messages can be sent to the terminal, a redirected output stream or both depending on the state of the client. Interestingly enough, if these implicit message statements occur during a UI statement that is being redirected to a named output stream destination, the message output does not go to that destination but instead goes to the terminal (***confirm this***).

Standard message statement (output only):


Unnamed INPUT Stream is Redirected (and marked NO-ECHO)

Unnamed INPUT Stream is Redirected (and marked ECHO)

Interactive INPUT Mode (Unnamed INPUT is NOT Redirected)

Unnamed OUTPUT is Redirected

redirected output only (not on the terminal)

redirected output only (not on the terminal)

output is sent to BOTH the redirected output destination AND to the terminal

Interactive OUTPUT Mode (Unnamed OUTPUT is NOT Redirected)

terminal output only

terminal output only

terminal output only


Message statement with a SET or UPDATE (input and output):


Unnamed INPUT Stream is Redirected (and marked NO-ECHO)

Unnamed INPUT Stream is Redirected (and marked ECHO)

Interactive INPUT Mode (Unnamed INPUT is NOT Redirected)

Unnamed OUTPUT is Redirected

input value is read from the redirected stream, NO output occurs to the stream***

input value is read from the redirected stream, the message text and the read input value are output to the stream***

switch to interactive mode for the input then the message text and the read input value are output to the stream***

Interactive OUTPUT Mode (Unnamed OUTPUT is NOT Redirected)

input value is read from the redirected stream, NO output occurs to the terminal

input value is read from the redirected stream, NO output occurs to the terminal

terminal input and output only


Note that the source of the redirected input stream makes a difference in behavior:


Output Redirected via Unnamed Stream

Output Redirected via Named Stream (only affects implicit message statement usage due to error messages)

Redirected input source is /dev/null

NO output to the terminal***
YES output to the stream

YES output to the terminal
NO output to the stream

Redirected input source is NOT /dev/null

YES output to the terminal
YES output to the stream

YES output to the terminal
NO output to the stream


The entries marked *** in the tables above are believed to be incomplete or incorrect in P2J.