There are three possible values that can be returned, depending on the message status, as follows:
Zero indicates that there is no message, so try again later. A value of 1 means that a message has just arrived, but does not need a response. 2 indicates that a message has been received which must be answered immediately with an appropriate return string. This function can be used in a loop, as an alternative to the AREXX WAIT command. For example:
X> Do If Arexx Print "A message is waiting!" Endif Multi Wait Loop
AREXX$
function: get a message from an AREXX program
message$=Arexx$(message number)
After a message has been successfully received from an AREXX compatible program, this function can be used to read its contents.
The number refers to the number of the message you wish to read, ranging from zero to 15. If it is not included, an empty string will be returned.
AREXX ANSWER
instruction: answer a message from an AREXX program
Arexx Answer error value
Arexx Answer error value,return$
Normally, when a message arrives from an AREXX program, it must be answered without delay. This command sends back a response to the calling program, with the special result fields set to the appropriate values. Typical values are:
0 No error 5 Warning 10 Severe error 20 Fatal error
If the AREXX program requests a return string, one must be sent back, otherwise the calling program will be left in limbo awaiting a response. This situation should be checked with the AREXX function, as explained above, and a return value of 2 means that a reply must be given immediately.
The AMOS Professional message system is intelligent, so if you attempt to return a string to an AREXX program which does not specifically request one, it will not be transmitted. Similarly, if the AREXX program is waiting for a string, but it is accidentally omitted from the instruction, an empty string will be sent by AMOS Professional automatically.