Previous Topic: WRITE JOURNAL (DC/UCF)Next Topic: WRITE LOG (DC/UCF)


WRITE LINE TO TERMINAL (DC/UCF)

The WRITE LINE TO TERMINAL statement transfers data from program variable storage to a terminal. WRITE LINE TO TERMINAL also establishes, modifies, and deletes page header lines.

Data transfers requested by WRITE LINE TO TERMINAL statements can be synchronous or asynchronous:

The system processes I/O requests in the sequence received from the task; thus, if a program issues a synchronous WRITE LINE TO TERMINAL request after issuing one or more asynchronous requests, the system will complete all I/O requests before returning control to the issuing program.

The WRITE LINE TO TERMINAL request issued automatically by the system to empty partially filled buffers upon completion of a task is synchronous; therefore, the terminal operator can view all screens and catch up with processing at that time. If an application allows the terminal operator to interrupt or terminate processing at some point within a task, a synchronous WRITE LINE TO TERMINAL request must be issued to suspend processing while awaiting an operator response.

Syntax
►►─── WRITE LINE TO TERMINAL ─┬──────────┬─┬───────────┬─┬──────────────┬─────►
                              ├─ WAIT ◄ ─┤ ├─ NEWPAGE ─┤ └─ NOBACKPAGE ─┘
                              └─ NOWAIT ─┘ └─ ERASE ───┘

 ►─── FROM (output-data-location) ─┬─ TO (end-output-data-location) ─┬────────►
                                   └─ LENGTH (output-data-length) ───┘

 ►─┬───────────────────────────────┬─ ; ──────────────────────────────────────►◄
   └─ HEADER (header-line-number) ─┘
Parameters
WAIT

Specifies that the write operation is synchronous; the issuing task automatically relinquishes control and must wait for completion of the output operation before processing can continue. WAIT is the default.

NOWAIT

Specifies that the write operation is asynchronous; the issuing task continues executing.

NEWPAGE

Writes the output data line beginning on a new page. For 3270-type devices, the NEWPAGE option forces the system to output the contents of the current buffer, even if the buffer is not full. The keywords NEWPAGE and ERASE are synonymous.

NOBACKPAGE

Specifies (for 3270-type devices only) that pages output in a scratch area are not to be kept. If NOBACKPAGE is specified, the terminal operator can view only the current page of output. NOBACKPAGE is valid only with the first I/O request in a line mode session.

FROM (output-data-location)

Identifies the program variable-storage entry of the data to be transferred to the terminal device, or the page-header line being created, modified, or deleted. Output-data-location is the symbolic name of a user-defined field. The length of the output data stream is determined by one of the following specifications:

TO (end-output-data-location)

Indicates the end of the program variable-storage entry that contains the output data stream and is specified following the last data-item entry in output-data-location. End-output-data-location is the symbolic name of either a user-defined dummy byte field or a field that contains a data item not associated with the output data.

LENGTH (output-data-length)

Defines the length, in bytes, of the output data area. Output-data-length is either the symbolic name of a user-defined field that contains the length of the data area, or the length itself expressed as a numeric constant.

Note: If the WRITE LINE TO TERMINAL statement is being used to delete a page-header line, output-data-length must be zero.

HEADER (header-line-number)

Specifies the number of the page header line being created, modified, or deleted. Header-line-number is either the symbolic name of a user-defined field that contains the header line number, or the header line number itself expressed as a numeric constant.

Examples

The following statement defines the value of a data area as a header to be displayed at the top of each new page written to the terminal:

WRITE LINE TO TERMINAL
 FROM (EMPL_HEAD) TO (END_EMPL_HEAD)
 HEADER (1);

The following statement writes the value in the specified data area to a new page on the terminal:

WRITE LINE TO TERMINAL
  NOWAIT NEWPAGE
  FROM (EMPL_RPT) LENGTH (60);
Status Codes

Upon completion of the WRITE LINE TO TERMINAL function, the ERROR_STATUS field in the IDMS DC communications block indicates the outcome of the operation:

0000

The request has been serviced successfully.

4707

A logical or permanent I/O error has occurred during processing.

4731

The line request block (LRB) contains an invalid field, indicating a possible error in the program's parameters.

4732

The derived length of the specified line output area is zero or negative.

4738

The specified program variable-storage entry has not been allocated as required. A GET STORAGE request must be issued.

4743

The line I/O session has been canceled; the terminal operator has pressed CLEAR (3270s), ATTENTION (2741s), or BREAK (teletypes).