In COBOL85, the SEND statement follows one of the following formats:
SEND <program name> FROM <variable name> SEND <program name> FROM <variable name> ON EXCEPTION <statement> SEND <program name> FROM <variable name> NOT ON EXCEPTION <statement>
Similarly, the RECEIVE statement follows one of the following formats:
RECEIVE <program name> INTO <variable name> RECEIVE <program name> INTO <variable name> ON EXCEPTION <statement> RECEIVE <program name> INTO <variable name> NOT ON EXCEPTION <statement>
The following are explanations of the various portions of these statements:
-
The program name stores the name of the matching program. The program name must be an alphanumeric literal or a variable, such as a DISPLAY item.
-
The variable name refers to a variable that stores or receives the message data. The variable specified must be an alphanumeric data item, such as a DISPLAY item.
-
The ON EXCEPTION clause specifies an action to be taken if the matching process is not ready to participate in the CRCR send or receive operation. If there is no ON EXCEPTION clause, the process waits until the matching process is ready. Using the ON EXCEPTION clause is equivalent to setting the No Wait flag in a CRCR_SEND or CRCR_RECV procedure invocation.
-
The NOT ON EXCEPTION clause specifies an action to be taken if the CRCR statement finishes successfully.
For further information about the contents of program names and variable names, refer to the discussion of the program name and message data parameters under Using CRCR Through Library Calls earlier in this section.
Following is a COBOL85 program that uses CRCR constructs.
IDENTIFICATION DIVISION.
ENVIRONMENT DIVISION.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 CRCR-PGM-NAME PIC X(256).
01 CRCR-DATA PIC X(2000).
PROCEDURE DIVISION.
BEGIN-PARA.
MOVE “(JASMITH)OBJECT/TEST/CRCR/ALGOL ON MISC.”
TO CRCR-PGM-NAME.
MOVE “TEST DATA TEST DATA TEST DATA “
TO CRCR-DATA.
SEND CRCR-PGM-NAME FROM CRCR-DATA.
MOVE “(JASMITH)OBJECT/TEST/CRCR/ALGOL ON MISC.”
TO CRCR-PGM-NAME.
RECEIVE CRCR-PGM-NAME INTO CRCR-DATA.
STOP RUN.
