FORTRAN Reference Manual

Interprocess Communication
FORTRAN Reference Manual528615-001
14-6
$RECEIVE as an Input File
$RECEIVE as an Input File
In the simplest case, the task-handling process uses $RECEIVE as an input file only. It
receives request messages from originating processes via $RECEIVE and acts upon
the requests. It does not generate a reply to each message, but an automatic reply is
sent when the next read operation is initiated. (Note that this default reply facility is
available only if QDEPTH is equal to 1.)
For example, a program might send print data to a spooler process instead of directly
to a printer. This program, the originator, might contain the following statements:
...
OPEN (UNIT=1,FILE='$spool')
...
WRITE (UNIT=1,FMT=11) a,b,c
11 FORMAT(1X,3F9.4)
...
The spooler process, the destination, receives the print lines by reading $RECEIVE:
?RECEIVE (OPEN 2)
CHARACTER*1 line(132)
OPEN (UNIT=1,FILE='$RECEIVE')
...
10 READ (UNIT=1,END=100) line
WRITE (UNIT=2) line
GO TO 10
...
100 STOP
END
The spooler process receives an end of file on $RECEIVE only when all processes that
opened the spooler process have closed it.
VST1405.vsd
ORIGINATOR request message
DESTINATION