Sequence Of Transaction I/O Statements; Clearing The Screen With Write; Close; I/O Error Processing - IBM 5280 Programmer's Manual

Distributed data system, cobol
Hide thumbs Also See for 5280:
Table of Contents

Advertisement

Sequence of Transaction I/O Statements
Don't issue two WRITEs in your program without executing a READ in
between. A READ must always be issued after a WRITE has been issued and
before a subsequent WRITE can be issued.
The READ must be issued whether or not a response is expected from the
operator.
You normally expect a response when one of the fields written to the screen
has been defined for both input and output. That is, a B has been specified in
the Usage field of the associated Data Definition Statements. After the
READ is executed, your program can process any command key codes or data
entered by the operator.
You normally don't expect a response when all of the fields have been defined
for output only. That is, an 0 has been specified in the Usage field(s) of the
associated Data Definition Statements. Nevertheless, the WRITE must be
followed by a READ before another WRITE can be issued.
Clearing the Screen with WRITE
CLOSE
I/O Error Processing
Status Key
A WRITE clears all data on the screen in lines following the starting line of
the data being written, and then writes the data defined (either explicitly or
by default) by the FORMAT clause.
In the example shown in figure 3.2, when an error message is written at
m,
m,
or
IB,
all information on the lines that follow the message line are erased.
Therefore, the screen with the original format is rewritten at
BJ.
The CLOSE statement detaches the work station associated with the
program. Once a transaction file is closed, it cannot be opened again
by your program before again loading the program.
This section discusses the use of the Status Key and Exception/Error
procedures in handling possible transaction I/O errors.
The Status Key is a 2-character data-item you define in the Data Division of
your program and name in the FILE STATUS clause, as shown for
TUBE-STAT in
B
in figure 3.3 later in this chapter.
It is recommended that you define a Status Key for all files and that your
COBOL program check the contents after each I/O request. Otherwise,
errors may go undiscovered by the program, producing results that are both
destructive and difficult to diagnose.
If neither a Status Key nor an EXCEPTION /ERROR procedure (described
later in this section) is present and an error occurs, the program will display a
message in the status line at the top of the screen. A message identifier in the
format 92nn will appear in the status line; nn is the code that would have been
placed in the Status Key had it been present.
See Appendix B for a complete list of the values that can be placed in the
Sta tus Key and their meanings.
3- 4
IBM 5280 COBOL Programmer's Guide

Advertisement

Table of Contents
loading

Table of Contents