Few AMOS programs have ARexx ports, despite the fact that they are easy to add. The following AMOS code opens an ARexx port called TEST_PORT, and waits for ARexx messages. If it receives the message ‘HELLO_AMOS’ it replies ‘Hello ARexx’, otherwise it replies with a warning (level 5).
Arexx Open "TEST_PORT"
Do
Arexx Wait
If Arexx$(0)="HELLO_AMOS"
Arexx Answer 0,"Hello ARexx"
Else
Arexx Answer 5,"Command not recognised"
End If
Loop
The following ARexx code address the port, says hello, and outputs the reply.
/* AMOS ARexx test */
Address 'TEST_PORT'
Options results
HELLO_AMOS
Say result