Using $RECEIVE
Initiating and Communicating With Processes
107365 Tandem Computers Incorporated
5–27
Figure 5-11. Creating CMON Messages (Page 3 of 4)
STRUCT run_info REDEFINES replytext;
BEGIN
FNAME progname;
INT priority;
INT processor;
END;
END;
?SECTION talk_to_cmon ROUTINE
== This routine accepts the names of two STRUCTs as its
== arguments. The first has been set by the caller to the
== message to send to CMON and the second is set by this
== routine to the response from CMON.
#FRAME
== Get the names of the two structures
#PUSH to_cmon from_cmon
#IF [#ARGUMENT/VALUE to_cmon/ VARIABLE]
#IF [#ARGUMENT/VALUE from_cmon/ VARIABLE]
#IF [#ARGUMENT END]
== Set the common information for the caller
#SET [to_cmon]:ci:groupuser [grp_usr &
[#PROCESSINFO/PAID/ [#MYPID]]]
#SET [to_cmon]:ci:cipri [#PROCESSINFO/PRI/ [#MYPID]]
#SET [to_cmon]:ci:ciinfile [#MYTERM]
#SET [to_cmon]:ci:cioutfile [#MYTERM]
== Open CMON
#PUSH e r p
#IF [#REQUESTER/WAIT 5000/ READ $cmon e r p]
== Show the message being sent
#OUTPUT -- Message to $CMON --
#OUTPUTV [to_cmon]
#OUTPUT ----------------------
== Send the message and get the reply
#APPENDV p [to_cmon]
#EXTRACTV r [from_cmon]
== Show the reply
#OUTPUT -- Reply from $CMON --
#OUTPUTV [from_cmon]
#OUTPUT ----------------------
== Exit, popping the variables and closing CMON
#UNFRAME