OUTPUT – Define output record

OUTPUT <segment> [KEYS(field1,field2,...)]
                 [FIELDS(field3,field4,...)]
                 [LABEL(YES|NO|NOFIELD|NOSEGMENT)]
                   [DATA(*|=|<dd-statement>)]
                   [LOADER(*|=|<dd-statement>)]

The KEYS keyword specifies a list of key fields to be output for the record, the FIELDS keyword specifies a list of non-key fields for the record. Workload Automation Programming Language makes no distinction between fields specified in KEYS or LIST when creating the output record; the distinction is made only if you are going to load the output file into ISPF using the undocumented EQQILSON utility.

The OUTPUT statement must precede any LIST or SELECT statements for which you want to specify the output characteristics.

You can define segment names as follows:
<segment>[=<alias>|*]
where:
segment
Required. The name of the HCL Workload Automation for Z segment for which you want to define output.
alias
Optional. An alternative name to use as the record label in the output.
*
Optional. A special case of alias that suppresses the segment label in the output.
You can define fields as follows:
[+|-][<iws-segment>.]<iws-field>[=<alias>|*|<length>]
where:
+ or –
Indicates that this field is to be used as the sort sequence, if the record is loaded into ISPF using EQQILSON (optional).
If the plus sign (+) or minus sign (–) is specified for use with EQQYXTOP, it does not impact the output, therefore the same FILESPEC member can be used by EQQYXTOP and EQQILSON to ensure that data is written from HCL Workload Automation for Z in the same way as it is loaded into ISPF.
iws-segment
Optional, needed only to reference a field from a parent segment. Reference only segments that are parents to the current segment; values from other segments might not be available.
iws-field
Required. The HCL Workload Automation for Z field name as described in Appendix A of Developer's Guide: Driving HCL Workload Automation for Z.
alias
Optional. An alternative field label to use in the output record.
*
Optional. A special case of alias that suppresses the field label in the output.
length
If a numeric length is specified instead of an alias, it suppresses the field label and generates a fixed width field.

For valid segment names, see OUTPUT field definition reference.

The LABEL keyword determines what happens with field and segment labels, as follows:
YES
Default. Labels appear at Field and Segment level, unless an asterisk (*) is specified.
NO
No labels appear.
NOFIELD
No field labels appear, but the segment is labeled.
NOSEGMENT
No segment label appears, but the fields are labeled.

The DATA keyword specifies the Output Destination for Data records generated for this segment. If no DATA Output Destination is specified for this segment and OPTIONS DATA is not specified, no Data records are written for this segment. If OPTIONS DATA is specified, the DATA keyword of OUTPUT is ignored and all Data Records are sent to the destination specified in DATA.

The LOADER keyword specifies the Output Destination for Batch Loader generated for this segment. If no LOADER Output Destination is specified for this segment and OPTIONS LOADER is not specified, no Batch Loader statement is written for this segment. If OPTIONS LOADER is specified, the LOADER keyword of OUTPUT is ignored and all Batch Loader is sent to the destination specified by LOADER.

Note: You can have multiple OUTPUT statements for the same segment, only the keywords specified are effective. If a keyword is not specified in an OUTPUT statement, the keywords of a previous OUTPUT statement for the same segment are applied. Therefore, you can specify fields and output destination in one statement and then divert subsequent output to an alternative destination with a later statement without having to specify all the fields again.
The following example shows multiple OUTPUT statements for the same segment. The ADCOM file contains fields ADID and ADDESC and is sent to MYOUT. This technique allows you to have standard file definitions and override the output destination without specifying all the fields again.
OUTPUT ADCOM FIELDS(ADID,ADDESC) DATA(OUTBL)
OUTPUT ADCOM DATA(MYOUT)

For each segment there is an in-built OUTPUT definition that includes all fields, sends ILSON data to OUTDATA, and sends batch loader data to OUTBL. To load all the fields for a segment, use the LOADDEF command to use these in-built definitions instead of coding your own OUTPUT statements. The LOADDEF command overrides the keywords in the OUTPUT statement, in a similar way to the use of subsequent OUTPUT statements for the same segment.