FORTRAN Reference Manual
Interprocess Communication
FORTRAN Reference Manual—528615-001
14-20
Message Queuing
Finally, control passes to the loop beginning at statement label 90 (lines 78 through
91), which reads and processes messages received via $RECEIVE. This loop treats
system messages as before (lines 51-58), but sends an end-of-file indication to all user
requests.
When the last opener has closed the server, the READ statement at line 79 receives
an end-of-file indication; control then passes to label 100 (line 92). After closing all of
its files, the server terminates its run with a stop message.
81 IF (request(1) .EQ. -30 .AND.
82 + MOD(request(2),16) .GT. 1) THEN
83 replycod = 28
84 ELSE
85 replycod = 0
86 END IF
87 ELSE
88 replycod = 1
89 END IF
90 WRITE (UNIT=6, MSGNUM=msgnum, REPLY=replycod)
91 GO TO 90
92 100 CONTINUE
93 CLOSE (UNIT=5)
94 CLOSE (UNIT=6)
95 CLOSE (UNIT=7)
96 STOP ' END OF QUEUEING SERVER RUN'
97 END
Example 14-4. Example Queued Server (Part 3 of 3)
98 ?PAGE "MATCHOLD FUNCTION"
99 FUNCTION matchold (record, dest, dest this rqr,no rqr)
100 INTEGER record(1), norqr, rqr
101 INTEGER dest(norqr,1), dest this rqr(1)
102 matchold = 0
103 DO 20 rqr = 1, no rqr
104 LIMIT = dest this rqr(rqr)
105 DO 10 I = 1, LIMIT
106 IF (record(1) .EQ. dest(rqr,I)) THEN
107 matchold = rqr
Example 14-3. Example Queued Server (Part 2 of 3)










