Guardian Programmer's Guide

Table Of Contents
Using the Sequential Input/Output Procedures
Guardian Programmer’s Guide 421922-014
15 - 48
Passing Messages Between Processes:
No Reply Data
Passing Messages Between Processes: No Reply Data
If no data is expected in the reply from the server process, then the requester process
can send messages to the server by issuing WRITE^FILE calls instead of READ^FILE.
The reply is received as soon as the server reads the message, but it contains no data.
There is no need for the server to explicitly send a reply. The only acknowledgment
that the sender (requester) receives is to be assured that the recipient (server) read the
message. This design is sometimes called one-way communication.
As with two-way communication, you must initialize all FCBs and the common FCB in
both processes before trying to send messages between the processes. Refer to
Initializing SIO Files Using TAL or pTAL DEFINEs earlier in this section.
Sending a Message to Another Process: No Reply Data
With all FCBs initialized, you need to do the following to send a message to another
process:
Open the server process using the OPEN^FILE procedure. You can use waited or
nowait I/O. The following example uses waited I/O:
CALL OPEN^FILE(COMMON^FCB,
SERVER^FILE);
Write the message to the server process using the WRITE^FILE procedure. This
example shows writing to a server opened with waited I/O:
BUFFER ':=' "Hello Server!" -> @S^PTR;
CALL WRITE^FILE(SERVER^FILE,
BUFFER,
@S^PTR '-' @SBUFFER);
Here, the WRITE^FILE procedure returns when the server process has read the
message from its $RECEIVE file.
Receiving Messages From Another Process: No Reply Data
Assuming that the server process has initialized a file FCB for each file that it will
access, you need to do the following to receive messages from a requester process:
Open the $RECEIVE file. You can open this file for waited or nowait I/O. The
following example opens $RECEIVE for waited I/O:
CALL OPEN^FILE(COMMON^FCB,
RECV^FCB);
Read each message from $RECEIVE with a READ^FILE procedure call.
Following the read operation, the read buffer contains the message and the
count-returned parameter indicates the number of bytes read.