You might be missing something. This is (one of) my TSO console pgms. The delay 
of 2 seconds could be a variaible.

/*  Issue command, receive response via the TSO CONSOLE command        rexx  */ 
                                                                           
                                                                              
 cons = userid()'C'                                                           
 cart = 'C'right(time('s'),7,0)                                               
 parse arg cmd                                                                
 cc= XTSO("Console deactivate")                                               
 cc= XTSO("CONSOLE SYSCMD("cmd") CART("cart") NAME("cons")")                  
 if cc>0 then do                                                              
   say 'Console rc' cc                                                        
   if datatype($.0)='NUM' then do n=1 to $.0                                  
     say $.n                                                                  
   end                                                                        
   Call close 20                                                              
 end                                                                          
                                                                              
 Do cn=1 to 2    /* #2 is sometimes needed to pick up all messages */         
   cm.0=0                                                                     
   cc= GETMSG('CM.','SOL',cart,,2)                                            
   if cc>4 then call close 8 "GETMSG error retrieving message, rc" cc         
   if cm.0=0 then leave                                                       
   do cmsgi=1 to cm.0                                                         
     say strip(cm.cmsgi,'t')                                                  
   end                                                                        
   if cm.0>1 then leave                                                       
 End                                                                          
 call close 0                                                                 
                                                                              
Close:                                                                        
 parse arg crc cmsg                                                           
 crc=word(crc 0,1)                                                            
 if cmsg<>'' then call line cmsg                                              
 cc= XTSO("Console deactivate")                                               
 Exit crc                                                                     
XTSO: trace off; zz=outtrap(word(arg(2) '$.',1))                              
        address tso arg(1);zz=outtrap('off');xtsorc=rc;return rc     

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN

Reply via email to