COBOL Manual for TNS/E Programs (H06.08+, J06.03+)
◦ PROMPT phrase
When the PROMPT phrase appears, and the device with which the file is associated is
either a terminal or a process (typically, a server), and the file’s open mode is I-O, the
value of prompt-item is sent to the file as part of the read operation.
The PROMPT phrase (often used for the WRITE/READ action common in requesters) is
effective only when the device with which the file is associated is either a terminal or a
process and the open mode of the file is I-O.
When these conditions are met, the PROMPT phrase causes the value of prompt-item
to be sent to the file before the actual read operation begins (as if a write operation
preceded the read operation). The record area is then cleared to spaces for the length
of the prompt-item. Characters being read from the terminal or process are then copied
into the record area.
When the specified conditions are not met, the PROMPT phrase is ignored.
If the file has variable-length records, then the DEPENDING ON data item does not affect
the length of the string written from the prompt-item. To write a variable-length
prompt-item, use reference modification. You can also write a variable-length
prompt-item by using an OCCURS DEPENDING phrase in the prompt-item, but then
you cannot use reference modification on the prompt-item elsewhere in the program.
◦ Inability to establish a position for the read operation
The run-time routines examine the file position indicator at the start of the read operation.
Certain settings of the file position indicator reflect that the read operation is unable to
retrieve any record:
– If the file position indicator indicates that no valid next record has been established,
the read operation terminates immediately with I-O status code “46.”
– If the file position indicator indicates that an optional file is not present, the run-time
routines change the setting of the file position indicator to indicate that the at-end
condition already exists. The read operation then terminates with I-O status code
“10.” Execution then proceeds as described in the rule for the at-end condition (see
the usage condition Retrieval).
• File-Status Data Item
You can declare a file-status data item for a file in its file-control entry. During each execution
of a READ statement, this file-status data item is assigned a new value that reflects the outcome
of the read operation.
The possible I-O status codes that result from successful read operations are:
Successful Read OperationI-O Status Code
The read operation was unconditionally successful.“00”
This is possible only when a file has the INSERTIONORDER attribute. The key value for
the alternate key that is serving as the current key of reference is equal to the value of that
same key in the record that is the next one in the file with respect to that key of reference.
“02”
The file is not described as having variable-length records (by having the RECORD
CONTAINS rec-1 TO rec-2 CHARACTERS clause or a RECORD VARYING clause in
“04”
its file description), and a record was read that was shorter than the maximum size. The
execution of the READ statement is successful.
A locked record was read successfully. (You must have called SETMODE to allow locked
records to be read.)
“97”
READ 409










