An ANSWER action automatically answers a specific outstanding read-and-reply message. The action-text consists of a response number indicator, which identifies the message being answered, followed by the text of the response
See 4.2 for formatting information.
Answer Action-Text Format
"\rridno\-response"
where:
\rridno\
is a variable or variable group member that specifies the read-and-reply identifier. If you are answering a read-and-reply message directly, use the variable _RRID as the read-and-reply identifier. If the read-and-reply identifier is part of matching message text, use the appropriate _TOKEN variable.
response
is the text used to answer the read-and-reply message. The response text can use variable and token substitution, and can be up to 68 characters long. It does not include the leading response number.
Example
This example uses one variable definition and two patterns to answer an outstanding message after waiting for a subsequent message.
The sequence of events in this example is as follows.
Step | Performed by | Action | Data |
1 | Application program | Sends a read-and-reply message to the console. | SWITCH MASTER LOG ("AT LOG SW L1") & ANS GO |
2 | CP-AMS | Matches pattern 1 in group EXAMPLE to the message. | SWITCH MASTER LOG ("AT LOG SW L1") & ANS GO |
3 | CP-AMS | Saves the read-and-reply id of the message in the user-defined variable LSRRID. | The value of _RRID is saved in LSRRID |
4 | CP-AMS | Sends an AT keyin to the console. | AT LOG SW L1 |
5 | Exec | Receives the keyin | |
6 | Exec | Switches the log file | |
7 | Exec | Sends a message to the console | AT LOG L1 newcycle *SWAP TO* time ----where newcycle is the file cycle for the system log and time is the time that the file cycle was opened. |
8 | CP-AMS | Matches the message to pattern 2 in group EXAMPLE | AT LOG L1 newcycle *SWAP TO* time |
9 | CP-AMS | Answers GO to the outstanding read-andreply message | ANSWER "\LSRRID\ -GO" |
10 | Application program | Receives the answer GO and continues |
DEFINE VARIABLE "LSRRID" TYPE STRING END DEFINE "EXAMPLE" 1 MESSAGE "SWITCH MASTER LOG (\"AT LOG SW L1\") & ANS GO" TYPE ANY-SENDER READ-AND-REPLY TOKEN KEYWORD 1 "SWITCH" TOKEN FIXED 6 "SW" SET LSRRID = \_RRID\ ACTION ALL COMMAND "AT LOG SW L1" END DEFINE "EXAMPLE" 2 MESSAGE "AT LOG L1 new-cycle *SWAP TO* time" TYPE PRIVILEGED-EXEC OTHER TOKEN KEYWORD 5 "*SWAP" TOKEN FIXED 6 "TO*" ACTION ALL ANSWER "\LSRRID\-GO" END