OPS/MVS

 View Only

 OPS/Rexx POS command not working as expected

Jump to Best Answer
Kyle_S's profile image
Kyle_S posted Mar 04, 2024 05:18 PM

I have an OPS/Rexx rule with POS statement problems.  Here is the context and the problem.

I have used POS command for decades and this is the first anomaly I recall having ever seen with it.  I don't have any colleagues that really use Rexx so here goes.

I have multiple If statements using POS all but one work (2 instances of same statement).  I have used 'trace i' in the AOF test facility to verify what I am seeing.

First, here is the source, then I will include extracts from the trace(bold accent added).

Select;                                                                        
  When msg.multiln = '1' then                                                  
    Do;                                                                        
      Parse Upper Var getvar.1 'MQ@' msg_type 'SEV=' severity .                
      Parse Upper Var text_2u . . drop_it                                      
    End; /* Do */                                                              
  When msg.singleln = '1' then                                                 
    Parse Upper Var MSG.TEXT 'MQ@' msg_type 'SEV=' severity . ,                
                drop_it                                                        
  Otherwise                                                                    
    Nop    /* Should never happen. */                                          
End;  /* Select */                                                             
  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -   16 Line(s) not Displayed 
If ((POS('END OF ALARM CONDITION',drop_it)>0) |,                               
    (POS('HAS BEEN UNINSTALLED',drop_it)>0)) then                              
   Signal reissue_msg_return                                                   
                                                                               
If ((POS(severity,'MIN CRI') > 0) |,                                           
    (POS(msg_type,'SYSMGDQ DLQ') > 0)) then              

'(POS(msg_type,'SYSMGDQ DLQ') > 0))' is the problem.  I also use it later on for another action and it fails similarly.  This works checking for the 'SYSMGDQ' value.  (Last week I switched the order of the literal string contents to 'DLQ SYSMGDQ' and the SYSMGDQ failed instead.)

So here is the problem, When the msgid (first word of the MSG.TEXT or getvar.1) is MQ@DLQ, the msg_type gets parsed correctly to DLQ, but in the POS command--DLQ is never found, i.e. rc =0. 

Here is an extract from the trace to show what I mean (bold accent added).  Also, not every desired message will have 'MIN' or 'CRI' so I can't count on that for selection:

*-* 251:   When msg.singleln = '1' then                                                                       
>V>     SINGLELN                                                                                              
>V>    1    
>L>    1    
>O>    1    
*-* 252:     Parse Upper Var MSG.TEXT 'MQ@' msg_type 'SEV=' severity . ,                                      
>V>     TEXT                                                                                                  
>V>     MQ@DLQ SEV=CRI QM01 QueueName: SYSTEMS.QMGR.DEAD.QUEUE (CurDepth >= 3), PLEASE CALL MAINFRAME ON CALL 
>L>     MQ@                                                                                                   
>L>     SEV=                                                                                                  
>>>     MSG_TYPE=DLQ                                                                                          
>>>     SEVERITY=CRI                                                                                          
>>>     DROP_IT=QUEUENAME: SYSTEMS.QMGR.DEAD.QUEUE (CURDEPTH >= 3), PLEASE CALL MAINFRAME ON CALL             
*-* 258: If msg.singleln = '1' then               /* SLWTO */                                                 
>V>     SINGLELN                                                                                              
>V>    1    
>L>    1    
>O>    1    
*-* 260:     MSG.DESC  = OPSBITS("JOBSTAT ")                                                                  
>V>     DESC                                                                                                  
>L>     JOBSTAT                                                                                               
>F>     .                                                                                                     
*-* 262: If msg.multiln = '1' then                /* MLWTO */                                                 
>V>     MULTILN                                                                                               
>V>    0    
>L>    1    
>O>    0    
*-* 273: If ((POS('END OF ALARM CONDITION',drop_it)>0) |,                                                     
>L>     END OF ALARM CONDITION                                                                                
>V>     QUEUENAME: SYSTEMS.QMGR.DEAD.QUEUE (CURDEPTH >= 3), PLEASE CALL MAINFRAME ON CALL                     
>F>    0    
>L>    0    
>O>    0    
*-* 274:     (POS('HAS BEEN UNINSTALLED',drop_it)>0)) then                                                    
>L>     HAS BEEN UNINSTALLED                                                                                  
>V>     QUEUENAME: SYSTEMS.QMGR.DEAD.QUEUE (CURDEPTH >= 3), PLEASE CALL MAINFRAME ON CALL                     
>F>    0    
>L>    0    
>O>    0    
>O>    0    
*-* 277: If ((POS(severity,'MIN CRI') > 0) |,                                                                 
>V>     CRI                                                                                                   
>L>     MIN CRI                                                                                               
>F>    5    
>L>    0    
>O>    1    
*-* 278:     (POS(msg_type,'SYSMGDQ DLQ') > 0)) then

>V>     DLQ                                                                                  
>L>     SYSMGDQ DLQ                                                                          
>F>    0    
>L>    0    
>O>    0    
>O>    1    
*-* 285:     If msg.singleln = '1' then         /*single line WTO           */               
>V>     SINGLELN                                                                             
>V>    1    
>L>    1    
>O>    1    
*-* 287:         MSG.DESC  = OPSBITS(11)                                                     
>V>     DESC                                                                                 
>L>    11    
>F>     ..                                                                                   
*-* 289:     If msg.multiln = '1' then          /*MLWTO                     */               
>V>     MULTILN                                                                              
>V>    0    
>L>    1    
>O>    0

* skipping irrelevant portion of trace *

*-* 391:          If (POS(msg_type,'SYSMGDQ DLQ') > 0) then                    
>V>     DLQ                                                                    
>L>     SYSMGDQ DLQ                                                            
>F>    0    
>L>    0    
>O>    0    
*-* 394:            "TXT2SYSP  " lpar_name " FC_QAD  " txt_msg_id text_2u

                   

The POS statements in 273 & 274 work unfailingly for selecting messages meeting those criteria.

The first POS statement in line 277  works unfailingly, but notice the intermediate values for the second one--it is the same problem for the statement on line 391 which is a **** IF using the same POS statement.

Either something basic is broken or I am really missing something obvious.

Thanks for your help.

Kyle Stewart

simon.phillips's profile image
simon.phillips Best Answer

msg_type = 'DLQ ' with a trailing space - either update the parsing or use the SPACE cmd

Parse Upper Var MSG.TEXT 'MQ@' msg_type' SEV=' severity . ,  

or

msg_type = space(msg_type)

PS and/or use WORDPOS instead of POS - which is a better test since it would avoid capturing MQ@MGD for example.

Kyle_S's profile image
Kyle_S

Simon,

That was great!  Thank you.  It solved my problem.  I just needed an additional pair of eyes.

Kyle