Previous Topic: ON Control StatementNext Topic: PRINT Control Statement


OUTPUT Control Statement

The OUTPUT control statement writes data to the output file.

Syntax

OUTPUT [expression-1] [COL(expression)] [SKIP]

where:

expression-1

Specifies an expression that determines the data to be written to the output file.

COL(expression)

Specifies an expression that determines the position to which expression-1 is written.

A value of 1 represents the first position of the output record. If this value is less than the current column position, the current output record is written to the output file, and expression-1 is placed in the new output record.

SKIP

Causes the current output record to be written to the output file.

The data from each OUTPUT control statement is queued contiguously in the output record. The output record is written under the following conditions:

Character, binary, packed, and time fields are written to the output record in its internal format and length. Date fields are written to the output record as a 4-byte Julian date in the form 0CYYDDDF. You can alter this circumstance using the EDIT function or by moving the data to a defined field.

Examples

To output tape dataset name, unit, and volume serial, use the following statements:

/OUTPUT TAPEDSN
/OUTPUT TAPEUNIT
/OUTPUT TAPEVOL

To output SYSOUT ID in column 1, archival date in YYYYMMDD format at column 40, and archival time in HHMMSS format at column 60, specify the following OUTPUT control statements:

/OUTPUT ID COL(1)
/OUTPUT EDIT(ARCHDATE,’YYYYMMDD’) COL(40)
/OUTPUT EDIT(ARCHTIME,’HHMMSS’) COL(60)