Using a Response Program in Robot/ALERT
When Robot/ALERT receives a response from a two-way device, it logs the response in the Robot/ALERT database. You can view the response from the Message Status panel, or write a response program to handle the response. For example, you can have the response sent to a specific user ID, or use the response to perform a function in your application.
Note: If you are using Robot/CONSOLE to manage iSeries messages, you do not need to write a response program. Robot/CONSOLE handles two-way device responses automatically.
Use the Robot/ALERT RBASNDMSG command to specify a response program you want to send with the two-way message. The parameters on the RBASNDMSG command that are used for two-way paging will display only when you enter a two-way pager or broadcast list in the Pager ID or Broadcast List field (see the Robot/ALERT User Guide for more information about the RBASNDMSG command.)
If you specify a program in the Response Program field, Robot/ALERT submits the response program when it receives a response. (When you send a two-way message to a broadcast list, all responses call the response program.) Robot/ALERT passes the following information to the response program: the response ID, the response text, and the two-way device that responded.
If you specified a library, Robot/ALERT adds it to the library list before calling the response program. The job is submitted using the job description RBARSPJOBD, which resides in the Robot/ALERT library.
Note: This job description can be changed, if necessary. However, if Robot/ALERT is updated, it could change the job description back to its original settings.
Response Program Input Parameters
When you are writing a response program, define the input parameters as follows (see the following examples):
| Parameter | Description |
| RspId (response ID) | The value in this 10-character field is the value that the response program can use to identify the originating message for the response and is passed to Robot/ALERT through the Response ID parameter on the RBASNDMSG command. |
| Pager | The value in this 10-character field is the two-way device that sent the response. |
| RspTxt (response text) | This value in this 160-character field is the response text from the two-way device, left-justified in the field. |
Example 1: Response is Sent to User ID
Program SNDMSGEX: Send Two-Way Message
The following example sends a message to a two-way device. In this example, the current user ID is retrieved and passed as the response ID (RSPID) to Robot/ALERT. The response program is specified on the RBASNDMSG command as‘*LIBL/RSPPGMEX’.
Program RSPPGMEX: Send Two-Message Response to User ID
The following example shows the response program specified by the SNDMSGEX program on the previous page. This program sends a response to the user specified in the response ID. When SNDMSGEX sends a message, it specifies the user ID sending the message as the Response ID. The message text is the response text from the two-way device.

Example 2: Response Updates Database
Program Inventory: Send Two-Way Message
This example consists of two programs and a sample file: 1) The first program sends a two-way message to request an amount to order; 2) The response program creates an order request record from the response; 3) The sample file is updated with the response from the two-way device.
Example Scenario
The scenario for this program is:
- Our inventory item file contains a quantity on hand and a reorder quantity. When the quantity on hand falls below the reorder point, we need to buy more of that item.
- Our inventory applications compare the quantity on hand to the reorder quantity any time that inventory is used. If the quantity on hand falls below the reorder quantity for a particular item, the application programs call this program, passing it an item number, item description, and the current quantity on hand.
- This program sends a two-way message to the ORDERMGR broadcast list. This broadcast list is an “N” type list (do not page next pager unless prior pager did not respond) and contains three devices. The people assigned to the list are the three managers who have the authority to place orders for more inventory.
- This program builds the message text for the message by concatenating the item number, the item description, and the quantity on hand.
- The Available Responses this program sends with the page are either NONE, or a value in the range of 1-10000, inclusive. It sets the restrict responses parameter to *YES. This means that the only values Robot/ALERT will accept for the response text from the two-way device are NONE (don’t place an order), or the quantity, from 1 to 10000, that should be ordered.
- The Response ID parameter on the command is set to the item number. Robot/ALERT stores the Response ID and passes it to the Response Program when it receives a response from the two-way device. The Response Program uses the Response ID (which is item# in this example) to create an order request for that particular item. The number of items to order is the quantity returned from the two-way device, and the person authorizing the order is actually the Pager (see the source for the response program INVORDREQ).
- Robot/ALERT submits the Response Program, passing it the Response ID, the Pager that responded to the message, and the Response Text.
- The response program is submitted when Robot/ALERT receives a response for a message that has a response program specified.
- The Response Program is specified on the RBASNDMSG command. In this example it is *LIBL/INVORDREQ.
- Our order request file (page 10) is used by one of our Electronic Data Interchange (EDI) programs to automatically place orders with our vendors.
Note: The sample program, INVENTORY, expects *CHAR (character) values to be passed. This makes it easier to build the &MSGTXT variable.
Note: We do not recommend using *LIBL for the Response Program Library because the library where the Response Progam resides may not be in the library list of the Robot/ALERT job. We also do not recommend putting the Response Program in the Robot/ALERT library because if Robot/ ALERT is updated, this information may not be retained.
Program Inventory: Send Two-Way Message

Program INVORDREQ: Create Record From Response
This example program is used with the INVENTORY program. When INVENTORY sends a two-way message, it specifies this program as the Response Program. INVENTORY passes the Response ID, which in this case is the item number that needs reordering. This program uses the item number from the Response ID, the Response Text from the two-way device, and the Pager field to create an Order Request record.
Order Request (INVREQ) File Fields
The Order Request file contains the following fields:
| Field | Type | Description |
| IRDATE | L(8) | Date this inventory order request is placed |
| IRTIME | P(4 0) | Time this inventory order request is placed |
| IRITEM | A(10) | The inventory order request ITEM number |
| IRQTY | P(8 0) | The inventory order request quantity |
| IRUSER: | A(10) | Who authorized this inventory order request |
| IRORDF: | A(1) | Has this order been filled (defaults to N). Will be changed to Y after the order is filled (received from vendor). |
Parameters Passed to INVORDREQ Program
The parameters passed to the INVORDREQ response program must be defined as shown below:
P1RspId = Response ID
In this example, the item number that needs to be ordered is passed as the Response ID.
P1Pager = The two-way device that sent the response
Used to identify who the response is from (if that information is needed). In this example, the two-way device is used as the person who authorized the order request.
P1RspTxt = Response Text
The response text from the two-way device. In this example, the quantity that should be ordered is the response text.




