In this section:
The SAY command writes messages to a file or to the default output device. You can use SAY for application debugging, such as tracing application control flow, and for recording an accounting trail. If you wish to display messages to application users, you should use forms, which provide superior display capabilities and better control than the SAY command.
The syntax of the SAY command is
SAY [TO ddname] expression [expression ...] ;
Is any Maintain expression. Multiple expressions must be separated by spaces.
Each message is written on the current line, beginning in the column that follows the end of the previous message. When a message reaches the end of the current line in the file or display device, or encounters a line feed (the string \n) in the message text, the message stream continues in column 1 of the next line.
If you write to output devices that buffer messages before displaying them, you may wish to end each message with an explicit line feed to force the buffer to display the last line of the message.
Specifies the logical name of the file to which the SAY message is written. ddname is a character expression. If you supply a literal for ddname, it must be enclosed by single or double quotation marks.
You must define the logical name using a DYNAM command on z/OS before the SAY command is executed. In order to append to an existing file (for example, to write to a file from more than one procedure), specify the appropriate option in the DYNAM command.
If TO ddname is omitted, the message is written to the default output device of the environment in which the SAY command is issued. For example:
If the message is written from a procedure that resides on a different server than the webpage, the message is prefixed with (FOC03764) From Server ==> to indicate that it was posted by a remote procedure.
In addition, if TO ddname is omitted and this procedure was called remotely (that is, called using a CALL procname AT command), the message will also be copied to the FocMsg stack of the calling procedure.
Note: Literals must be enclosed in single or double quotation marks, while variables do not appear in quotes.
You can use the SEG and STACK prefixes to write the values of all the fields of a segment or columns of a stack to a message. This can be helpful when you write messages to log and checkpoint files.
SEG.fieldname inserts Current Area values for all of the fields of the specified segment. STACK.stackname(row) inserts, for the specified stack, the values of the specified row.
The rules for specifying messages using the SAY command are simpler and more powerful than those for the TYPE command. For example, you can include all kinds of expressions in a SAY command, but you can only include character string constants and scalar variables in a TYPE command.
Note that, unlike the TYPE command, the SAY command does not generate a default line feed at the end of each line.