COBOL Manual for TNS/E Programs (H06.08+, J06.03+)
• The OPEN SYNCDEPTH value in the requester process that opens the server process must not
exceed the sync value in the RECEIVE-CONTROL paragraph of the server process.
• Only one reply WRITE to each READ on $RECEIVE is allowed. If you fail to reply to a message
before you read the next one, the HP COBOL run-time routines send a default reply. In this
situation, you cannot reply to that earlier message.
• A program can use $RECEIVE whether or not the program runs as a process pair.
• The contents of the record area associated with $RECEIVE are subject to modification by the
HP COBOL run-time routines. Even if a process has not requested delivery of system messages
in the RECEIVE-CONTROL paragraph, the run-time routines handle system messages in the
$RECEIVE record area. These unrequested messages are not delivered to the process. If a
process modifies the record area and then performs a read operation on $RECEIVE, the portion
of the record area beyond the actual received message can include residue of such system
messages.
• If you want to know the length of the record you read from $RECEIVE, identify them with
RECORD IS VARYING... DEPENDING, which enables you to determine the length of the
message that was sent to $RECEIVE by the requester.
• If the ASSIGN clause specifies $RECEIVE, the upper limit of the RECORD CONTAINS clause
is 2MB and the maximum size of a logical record for the file is 2MB. If the ASSIGN clause
specifies a define name, even a define that translates to $RECEIVE, the maximum record size
is limited to 32KB. If the file is not associated with $RECEIVE until runtime (for example, by a
TACL ASSIGN command or by a call to COBOL_ASSIGN_), the maximum record size of the
file is 32KB only.
Simple Server Example
The simple server in Example 307 looks up items in a telephone directory.
Example 307 Simple Server
IDENTIFICATION DIVISION.
PROGRAM-ID. BRIEF-EXAMPLE.
AUTHOR. ZANE COBOL.
DATE-WRITTEN. 29 February, 1988
DATE-COMPILED.
**************************************************************************
* This simple server performs telephone-book lookups. *
* Given a name, it reports the name and a number. *
* Given a number, it reports the number and a name. *
* It assumes that no two persons have the same number or the same name. *
**************************************************************************
ENVIRONMENT DIVISION.
CONFIGURATION SECTION.
SOURCE-COMPUTER. HP TXP System.
OBJECT-COMPUTER. HP TXP System.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
* Declaring MESSAGE-IN and MESSAGE-OUT separately allows us to
* redirect either or both for debugging during development.
SELECT MESSAGE-IN
ASSIGN TO $RECEIVE
FILE STATUS IS RECEIVE-FILE-STATUS.
SELECT MESSAGE-OUT
Communicating With a Process 925










