How to code a WTOR in REXX and how to retrieve the reply?
search cancel

How to code a WTOR in REXX and how to retrieve the reply?

book

Article ID: 196755

calendar_today

Updated On:

Products

OPS/MVS Event Management & Automation

Issue/Introduction

How to check the response of a WTOR issued by OPS/REXX? 



Environment

OPS/MVS

Resolution

The keyword "REPLY" of the ADDRESS WTO statement causes the message to be a WTOR.

The reply of the WTOR can be retrieved using the PULL REXX instruction.

Sample code below:

/* REXX TO ISSUE WTOR AND TAKING DIFFERENT ACTIONS  */   
/* DEPENDING ON THE RESPONSE                        */   
/* Re-issues the WTOR if the response is not Y or N */   
ask:                                                     
ADDRESS WTO                                              
text = 'TESTING WTOR - REPLY (Y/N)'                      
address WTO "TEXT('"text"') HILITE REPLY MSGID('U00001')"
Do queued()                                              
  pull prefix response .                                 
end                                                      
if wordpos(response,'Y N') = 0 then signal ask /* re-issues the WTO if not Y or N */       
      else                                               
       do                                                
        if response = 'Y' then                           
            do                                           
              say 'Actions when response=Y'              
            end                                          
        if response = 'N' then                           
            do                                           
              say 'Actions when response=N'              
            end                                          
       end