midrange.com code scratchpad
Name:
QSH0005
Scriptlanguage:
Ruby
Tabwidth:
4
Date:
02/24/2020 08:25:38 pm
IP:
Logged
Description:
Retrieve status code from msg QSH0005
Code:
  1. Dcl-PR rcvmsg                                        ExtPgm('QMHRCVPM') ; 
  2.   *n             Char(256)  ;                                             
  3.   *n             Int(10)             Const  ;                             
  4.   *n             Char(8)             Const  ;                             
  5.   *n             Char(10)            Const  ;                             
  6.   *n             Int(10)             Const  ;                             
  7.   *n             Char(10)            Const  ;                             
  8.   *n             Char(4)             Const  ;                             
  9.   *n             Int(10)             Const  ;                             
  10.   *n             Char(10)            Const  ;                             
  11.   *n             Char(256)  ;                                             
  12. End-PR  ;                                                                 
  13.  
  14. Dcl-DS msgParm       Qualified  ;                                        
  15.  msg                 LikeDS(msgDS)  ;                                    
  16.  msgLen              Int(10)         Inz(%Len(msgParm.msg)) ;            
  17.  format              Char(8)         Inz('RCVM0100')  ;                  
  18.  callStkEntry        Char(10)        Inz('*') ;                          
  19.  callStkCntr         Int(10)         Inz(0) ;                            
  20.  msgType             Char(10)        Inz('*COMP') ;                      
  21.  msgKey              Char(4)         Inz(*Blanks) ;                      
  22.  waitTime            Int(10)         Inz(0) ;                            
  23.  action              Char(10)        Inz('*REMOVE') ;                    
  24. End-DS  ;                                                                
  25.  
  26. Dcl-DS msgDS        Len(256)  ;                                          
  27.  bytesReturned      Int(10) ;                                            
  28.  bytesAvailable     Int(10) ;                                            
  29.  *n                 Int(10) ;                                            
  30.  msgID              Char(7) ;                                            
  31.  msgData            Int(10)         Pos(49) ;                            
  32. End-DS  ;                                          
  33.  
  34. Dcl-DS errDS  ;                                  
  35.  *n                Uns(10)    Inz(%Len(errDS))  ;
  36.  errAvl            Uns(10)  ;                    
  37.  *n                Char(7)  ;                    
  38.  *n                Char(1)  ;                    
  39.  *n                Char(240)  ;                  
  40. End-DS  ;                                        
  41.  
  42. Dcl-C  #QSH0005      'QSH0005'  ;  
  43.  Dcl-Proc exec ;// Calls QCMDEXC                                                                    
  44.  Dcl-PI   *n      Ind  ;//                                                                          
  45.   status          Int(3)              Value  ;                       
  46.                                                                        
  47.  
  48. // call to qshell 
  49.  
  50.  DoU ( msgParm.msg.msgID = #QSH0005                                    
  51.  Or    msgParm.msg.bytesAvailable = 0 )  ;                             
  52.    rcvMsg( msgParm.msg                                                 
  53.          : msgParm.msgLen                                              
  54.          : msgParm.format                                              
  55.          : msgParm.callStkEntry                                        
  56.          : msgParm.callStkCntr                                         
  57.          : msgParm.msgType                                             
  58.          : msgParm.msgKey                                              
  59.          : msgParm.waitTime                                            
  60.          : msgParm.action                                              
  61.          : errDS                                                       
  62.          ) ;                                                           
  63.  EndDo ;                                                               
  64.  If ( msgParm.msg.msgID = #QSH0005 ) ;// qshell exit status 
  65.   status = msgParm.msg.msgData;
  66.   Return ( msgParm.msg.msgData <> 0 ) ;// return *On if qshell error   
  67. Else  ;                                   
  68.   Return *Off ;// wasn't a shell call     
  69. EndIf ;                                                 
© 2004-2019 by midrange.com generated in 0.059s valid xhtml & css