COBOL Manual for TNS/E Programs (H06.08+, J06.03+)
INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT PRINT-LINES-IN
ASSIGN TO "$RECEIVE"
ORGANIZATION IS SEQUENTIAL
ACCESS MODE IS SEQUENTIAL
FILE STATUS IS PRINT-STATUS.
DATA DIVISION.
FILE SECTION.
FD PRINT-LINES-IN
LABEL RECORDS ARE OMITTED.
01 LINE-IN PICTURE X(80).
WORKING-STORAGE SECTION.
01 PRINT-STATUS PICTURE X(2).
88 SENDER-DISAPPEARED VALUE "10".
PROCEDURE DIVISION.
A.
OPEN INPUT PRINT-LINES-IN.
PERFORM TRANSPUT THROUGH END-TRANS
UNTIL SENDER-DISAPPEARED.
STOP RUN.
TRANSPUT.
READ PRINT-LINES-IN
AT END GO TO END-TRANS.
DISPLAY LINE-IN.
END-TRANS.
EXIT.
RECEIVE-CONTROL Paragraph
The RECEIVE-CONTROL paragraph of the Environment Division is an HP extension to COBOL. The
RECEIVE-CONTROL paragraph in process $XX serves these purposes:
• It defines the receive-control table for process $XX. This specifies the maximum number of
other processes that can have process $XX open concurrently. When all such other processes
close process $XX, an HP COBOL run-time routine reports an end of file (EOF) on $RECEIVE.
• It defines the reply table for process $XX. This specifies the number of replies (and the length
of a reply) to be saved for each requesting process. A process with a fault-tolerant requester
must allow for replies to be saved so that the fault-tolerant facility can retransmit them to restore
synchronization in the case of a takeover by the requester’s backup process. (If the requester
is not fault-tolerant, the reply table is useless and wastes space.)
• It designates a data item to contain an error code to be returned to a requesting process that
is handling process $XX as a device. Every device in the system returns an error code, a
condition code, and a reply-message text.
• It designates a data item to contain the message source descriptor. This fixed-format item is
defined in RECEIVE-CONTROL Paragraph (page 143). When the HP COBOL run-time routines
complete a successful READ on $RECEIVE, they update this data item to report:
◦ The message source (the operating environment or another user process)
◦ The entry number in the receive-control table
◦ The process ID of the requesting process (name, processor number, and number of process
in that processor)
Communicating With a Process 923










