Programs in languages other than COBOL85 can perform CRCR send and receive operations by calling the CRCR_SEND and CRCR_RECV procedures in the EVASUPPORT system library. These procedures each receive four parameters, which must be declared in the following order: program name, program name length, message data, and No Wait flag. These procedures also return a real value indicating the procedure result.
Program Name (EBCDIC Array)
Stores the name of the matching CRCR program. The value must be a file title of up to 256 characters in length. It is not necessary to terminate the value with a period.
If the program name does not include a usercode, the system prefixes the program name with the same usercode as the process executing the statement.
The system compares the program name with the NAME task attribute of possible matching processes. Any ON <family> clause on either side is ignored in the comparison. Otherwise, the program name and the NAME task attribute must be an exact match in order for interlock to occur.
There is one exception to the requirement for exact matches. In a CRCR_RECV invocation, the program name specified can be all blank characters. This type of invocation is referred to as a global receive operation. In such a case, the process interlocks with any other process that is attempting a send operation.
Note that the reverse capability, a global send operation, does not exist. If the program name for a send operation is all blanks, the process waits indefinitely and the send operation is never completed.
Program Name Length (Integer)
The user program must use this parameter to specify the length of the program name, in units of characters.
Message Data (EBCDIC Array)
Stores or receives the message data.
The variable declared in the sending process can be of a different type than the variable declared in the receiving process. However, the system does not perform any data translation. The data received is a bit image of the data that was sent.
The size of the variable is limited only by the amount of memory required by the sending and receiving processes. If the receiving variable cannot hold all the data that is sent, the system truncates the data and sends what can fit. If the receiving variable is larger than the sending variable, the system left-justifies the data and adds blank fill to the right.
No Wait Flag (Real)
A real variable that indicates whether the user program is willing to wait for the interlock to occur.
An interlock can be delayed if the matching process is not currently running or has not executed its send or receive operation yet. By default, the user program becomes suspended if the matching process is not ready, and resumes executing when the interlock occurs.
However, by setting bit [00:01] of the No Wait flag, the user program can indicate that the send or receive operation should be abandoned if the matching process is not ready to interlock. The user program continues running and can attempt the send or receive operation again later.
Procedure Result (Real)
CRCR_SEND and CRCR_RECV each return a real value indicating the result of the requested operation. The format of this value is described under Handling the CRCR or STOQ Result later in this section.
Using CRCR in ALGOL
The following is an example of an ALGOL program that invokes the CRCR_RECV and CRCR_SEND procedures.
BEGIN
EBCDIC ARRAY CRCR_PGM_NAME [0:255];
INTEGER CRCR_PGM_NAME_LEN;
EBCDIC ARRAY CRCR_DATA [0:19999];
REAL CRCR_FLAGS, RESULT_STATUS;
LIBRARY EVASUPPORT (LIBACCESS = BYFUNCTION,
FUNCTIONNAME = “EVASUPPORT.”);
REAL PROCEDURE CRCR_RECV (CRCR_PGM_NAME,
CRCR_PGM_NAME_LEN,
CRCR_DATA,
CRCR_FLAGS);
EBCDIC ARRAY CRCR_PGM_NAME [*];
INTEGER CRCR_PGM_NAME_LEN;
EBCDIC ARRAY CRCR_DATA [0];
REAL CRCR_FLAGS;
LIBRARY EVASUPPORT;
REAL PROCEDURE CRCR_SEND (CRCR_PGM_NAME,
CRCR_PGM_NAME_LEN,
CRCR_DATA,
CRCR_FLAGS);
EBCDIC ARRAY CRCR_PGM_NAME [*];
INTEGER CRCR_PGM_NAME_LEN;
EBCDIC ARRAY CRCR_DATA [0];
REAL CRCR_FLAGS;
LIBRARY EVASUPPORT;
REPLACE CRCR_DATA[0] BY “DATA MESSAGE”;
REPLACE CRCR_PGM_NAME[0] BY “(USER)PROGRAM/NAME”;
CRCR_PGM_NAME_LEN:= 18;
CRCR_FLAGS:= 0; % WAIT FOR HOOKUP
CRCR_SEND(CRCR_PGM_NAME, CRCR_PGM_NAME_LEN,
CRCR_DATA, CRCR_FLAGS);
REPLACE CRCR_DATA[0] BY “ “ FOR SIZE(CRCR_DATA);
REPLACE CRCR_PGM_NAME[0] BY “(USER)PROGRAM/NAME”;
CRCR_PGM_NAME_LEN:= 18;
CRCR_FLAGS:= 0; % WAIT FOR HOOKUP
CRCR_RECV(CRCR_PGM_NAME, CRCR_PGM_NAME_LEN,
CRCR_DATA, CRCR_FLAGS);
END.Using CRCR in COBOL74
The following rules apply to the data items passed as parameters to CRCR_SEND or CRCR_RECV in COBOL74:
-
The program name length parameter must be a level 77 item of type PIC S9(11) BINARY.
-
The message data parameter must be of either level 77 or level 01. If a level 01 item is used, all subordinate items are passed as part of the message data.
-
The flag parameter and the result status must be level 77 items of type REAL.
IDENTIFICATION DIVISION.
ENVIRONMENT DIVISION.
DATA DIVISION.
WORKING-STORAGE SECTION.
77 RESULT-STATUS REAL.
77 CRCR-PGM-NAME-LEN PIC S9(11) BINARY.
77 CRCR-FLAGS REAL.
01 CRCR-PGM-NAME PIC X(256) WITH LOWER-BOUNDS.
01 CRCR-DATA PIC X(20000).
PROCEDURE DIVISION.
BEGIN-PARA.
CHANGE ATTRIBUTE LIBACCESS OF “EVASUPPORT”
TO BYFUNCTION.
MOVE “(EVAENG)OBJECT/TEST/CRCR/ALGOL ON MISC.”
TO CRCR-PGM-NAME.
MOVE 39 TO CRCR-PGM-NAME-LEN.
CALL “CRCR_RECV OF EVASUPPORT”
USING CRCR-PGM-NAME, CRCR-PGM-NAME-LEN,
CRCR-DATA, CRCR-FLAGS
GIVING RESULT-STATUS.
CALL “CRCR_SEND OF EVASUPPORT”
USING CRCR-PGM-NAME, CRCR-PGM-NAME-LEN,
CRCR-DATA, CRCR-FLAGS
GIVING RESULT-STATUS.
STOP RUN.
