Guardian Programmer's Guide

Table Of Contents
Using the File System
Guardian Programmer’s Guide 421922-014
2 - 24
SBUFFER ':=' "PLEASE ENTER ACCOUNT NUMBER: " -> @S^PTR;
WCOUNT := @S^PTR '-' @SBUFFER;
RCOUNT := 72;
CALL WRITEREADX(FILENUM,
SBUFFER,
WCOUNT,
RCOUNT,
NUMXFERRED);
The call writes 30 bytes from the memory buffer SBUFFER, then prepares for reading
up to 72 bytes of information back into the same buffer. A count of the number of bytes
entered is given in NUMXFERRED.
I/O With Processes
A process writes messages to another process by writing to the open process file. To
read messages sent by another process, your process must read from its $RECEIVE
file. (By default, messages from the operating system are also read through
$RECEIVE; you can choose not to receive file management system messages,
however, by setting the appropriate bit in the FILE_OPEN_ procedure options
parameter.)
Communication between processes can be two-way or one-way. In two-way
communication, the first process sends a message to the second process, and then
the second process reads the message and responds with reply information. In one-
way communication, one process simply sends a message to the other and the other
process reads it; the second process passes no information in the response to the first
process.
Consider a requester process $REQ that performs two-way communication with a
server process $SER1. $REQ opens $SER1 and $SER1 opens $RECEIVE. Because
$REQ wants to read a reply from $SER1, it sends a request message using the
WRITEREADX procedure. Because the server expects to send reply text or an error
indication back to the requester, it reads the message from $RECEIVE using a
READUPDATEX call and then sends a reply using a REPLYX call.
$REQ $SER1
NAME ':=' "$SER1"; NAME ':=' "$RECEIVE";
LEN := 5; LEN := 8;
ERROR := FILE_OPEN_( ERROR := FILE_OPEN_(
NAME:LEN, NAME:LEN,
FN, FN,
!access!, !access!,
!exclusion!, !exclusion!,
!nowait^depth!, !nowait^depth!,
1); 1);
. .
. .
BUFF ':=' "MESSAGE..."; .
CALL WRITEREADX(FN,BUFF, CALL READUPDATEX(FN,BUFF,
WCOUNT,RCOUNT); RCOUNT);
.