OpenTP1 Version 7 Programming Reference COBOL Language

[Contents][Index][Back][Next]

RECEIVE - Receive a message

Format

DATA DIVISION (communication description entry) specification

CD communication-description-name
   FOR {INPUT|I-O}
   [STATUS KEY IS data-name-1]
   [SYMBOLIC TERMINAL IS data-name-2]
   [MESSAGE DATE IS data-name-3]
   [MESSAGE TIME IS data-name-4].
 
01 unique-name-1.
   02 data-name-5  PIC  9(4) COMP.
   02 data-name-6  PIC  X(4).
   02 data-name-7  PIC  X(n).

PROCEDURE DIVISION (communication statement) specification

RECEIVE communication-description-name
    [FIRST] SEGMENT
       INTO unique-name-1.

Description

RECEIVE enables the following CALL interface facility:

The maximum length of a single segment that can be received is 32763 bytes. Note that the actual maximum length might be smaller than this value depending on the protocol. For details, see the relevant description in the applicable OpenTP1 Protocol manual.

In the case of receiving a message sent from a remote system via a protocol, the syntax of the RECEIVE statement varies from one protocol to another. For the syntax of the RECEIVE statement for receiving a message from a remote system, also see the relevant description in the applicable OpenTP1 Protocol manual.

Items specified in the communication description entry

FOR clause

Specify one of the following:

INPUT: Receive a non-inquiry message

I-O: Receive an inquiry message

STATUS KEY clause

Specify this clause to receive a status code. If this clause is omitted, a status code cannot be received.

SYMBOLIC TERMINAL clause

Specify the data item for referencing the logical terminal name of the message input source.

MESSAGE DATE clause

Specify the data item for referencing the date when the message is received in the format of YYMMDD (where YY indicates the year, MM indicates the month, and DD indicates the day).

MESSAGE TIME clause

Specify the data item for referencing the time when the message is received in the format of HHMMSS00 (where HH indicates hours, MM indicates minutes, SS indicates second, and 00 is fixed).

Items specified in the communication statement

FIRST

Specify this item to receive the first segment.

unique-name-1

Specify the data item indicating the area for receiving a segment. When the message is sent from the local system, the maximum length of receiving segment is 32000 bytes. When the message is sent from the remote system, the maximum length of receiving segment depends on the communication protocol supporting product.

[Figure]

Status codes

Status code Explanation
00000 Normal termination.
A segment shorter than the receive area was received. The blank area after the segment will be padded with spaces.
71000 The RECEIVE statement for receiving the first segment was executed more than once. To receive an intermediate segment or the last segment, execute the RECEIVE statement without specifying FIRST.
71001 The RECEIVE statement for receiving the next segment was executed after the last segment of the message was received. The RECEIVE statement executed immediately before receives a message completely. If the RECEIVE statement is executed again after this status code is returned, the status code "72000" is returned.
71002 An error occurred during input/output processing for the message queue.
The message queue is in shutdown state.
72000 Return at MHP execution:
The RECEIVE statement for receiving an intermediate segment or the last segment was executed before the RECEIVE statement for receiving the first segment was executed.
To receive the first segment, execute the RECEIVE statement specifying FIRST.
The RECEIVE statement was executed again after the status code "71000" was returned.
Return at SPP execution:
The RECEIVE statement cannot be executed from an SPP.
72001 The logical terminal name specified for the SYMBOLIC TERMINAL clause is invalid.
The specified logical terminal cannot execute the RECEIVE statement.
72013 A segment exceeding the length of the receive area was received. The excess portion was truncated.
A segment exceeding 32,767 bytes was received in the case of buffer format 2. The excess portion was truncated.
72020 The value specified for the SYNCHRONOUS MODE clause is invalid.
72024 The value specified for the FOR clause is invalid.
72036 The segment receive area (unique-name-1) is insufficient. Allocate an area of 5 bytes or more.
Other than the above An unprecedented error (e.g., program damage) occurred.