SAY

In this section:

How to:

Reference:

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.


Top of page

x
Syntax: How to Use the SAY Command

The syntax of the SAY command is

SAY [TO ddname] expression [expression ...] ;

where:

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 message's last line.

TO ddname

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 applications run from a terminal in a Mainframe environment, the default device is the terminal.

Note: Literals must be enclosed by single or double quotation marks, while variables do not appear in quotes.


Top of page

x
Reference: Commands Related to SAY

TYPE writes messages to a file or to a form.


Top of page

x
Writing Segment and Stack Values

You can use the SEG and STACK prefixes to write the values of all a segment's fields or a stack's columns 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 specified segment's fields. STACK.stackname(row) inserts, for the specified stack, the specified row's values.


Top of page

x
Choosing Between the SAY and TYPE Commands

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 only 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.


Information Builders