New way in RPG to monitor for errors

In RPG we have been able to monitor for errors, using a Monitor group, for years. Until IBM i 7.5 and 7.4 TR6 we could only monitor for program and file status codes. I have always preferred CL’s MONMSG that allowed me to monitor by message id instead.

As part of the new release, or new TR for 7.4, there is a new RPG operation code, ON-EXCP, that can be used within a Monitor group to monitor for a specific error message or messages. The syntax is very similar to that of the ON-ERROR operation code:

monitor ;
Something
on-excp ‘CPF1234’ : ‘RNX1234’ : ‘RNQ1234’ ;
Do something else to mitigate the error
endmon ;

I am going to give some examples below so you can understand how ON-EXCP works. Here is my RPG program’s source code:

Read more »

Verified by MonsterInsights