Previous Topic: SAM()

Next Topic: SCANSTR()

SAYWHAT()

Use SAYWHAT() to direct the output of TRACE and SAY operations to a data set.

Syntax

The SAYWHAT() function has this syntax:

Form 1:

dcb = SAYWHAT(OPEN,,[lines],[output],[opt1],[head],[class],[opt2],[dest],[ddname])

Form 2:

dcb = SAYWHAT(USE,dcb)

Form 3:

dcb = SAYWHAT(CLOSE,dcb)

Arguments

The SAYWHAT() function takes these arguments:

dcb

Value that identifies a file and an associated internal workspace. The DCB is returned by the OPEN operation and is required for all other functions.

OPEN

Allocates and opens a new file, and returns a dcb.

,,

Argument two is reserved and must be null.

USE

Indicates that the designated file is to be used for future SAY or TRACE output. You can use this argument to alternate output among multiple files.

Specifying SAYWHAT('USE',0) terminates directed SAY or TRACE output, and causes additional SAY or TRACE output to be printed in the ISERVE log file (ISRVLOG).

lines

Number of lines of data per page, not including lines used by the page headers. Null or zero indicates a page of infinite length. The default is 0.

output

Name of an OUTPUT JCL statement to be associated with this file.

opt1

Specify one of the following:

CC indicates that you will supply an ANSI carriage control character (1, ' ', 0, -, +) for each record you create with a SAY.

NOCC indicates that you will not supply an ANSI carriage control character for each record you create with a SAY. ANSI carriage control characters (single space) will be supplied by the system.

head

One or more strings to be used as page headings. Headings are separated from each other by a semicolon (;). Each heading must begin with an ANSI carriage control character. The first header must have a 1 (one) as its carriage control.

 

If you want one or more blank lines between the headings and data lines, you must explicitly code a blank heading line.

The following value may not exceed 256, not including semicolons:

(Total characters in headings) + (4*(number of headings)) + 2

To print the current page number, code a single occurrence of '@@@@' in your heading. This string will be replaced by the page number.

class

SYSOUT class to be assigned.

Default: The default class assigned by the operating system.

opt2

Specify one of the following:

HOLD indicates that the spun file is held.

NOHOLD indicates that the spun file will not be held; the default.

dest

User ID or node.userid to indicate the destination for routing the file.

ddname

DDname (supplied from JCL or the ALLOC() function) of the file to be used. Overrides the output, class, hold, and dest arguments.

CLOSE

Indicates the file is to be closed and spun.

Return Codes

The SAYWHAT() function produces these return codes:

-123

INVALID FILE DCB

101 - 110

ARG n MISSING OR INVALID

122

FILE FAILED TO OPEN

Example

ddname = alloc('RBROWNE.SAYOUT','SHR',,'DD1')  /* Output data set */
dcb = saywhat('open',,,,,,,,,ddname)      /* Tell SAYWHAT about it */
saywhat('use',dcb) == ''                  /* Switch SAY output */
say 'should go to RBROWNE.SAYOUT'
saywhat('use',0) == ''                    /* Switch back, and close file */