× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.




I am looking at the opcode MONITOR. In a program, I am forcing a divide by zero, and then expecting to see the excpt_nbr or excpt_id with a value of 00102 or 0102. In debug, they both show values of of *Blanks.

What am I not doing?

It's hard to say what you're "not doing" since you didn't post any code, and I don't know what 'excpt_nbr' and 'excpt_id' are.


I usually use the %STATUS BIF to get the error number that occurs. So I might code something lihe the following:

     D x               s             10I 0 inz(0)
     D status          s             10I 0 inz(0)

      /free

          monitor;
            x = 1 / x;
          on-error;
            status = %status;
            dsply status;
          endmon;

          *inlr = *on;

      /end-free

In that case, it'll display 102 on the screen.

Of course, you can also tell the MONITOR op-code to only look for a particular status code... that way, if something you didn't expect occurs, it won't be "caught" by the on-error operation.

For example:

     D x               s             10I 0 inz(0)

      /free

          monitor;
            x = 1 / x;
          on-error 102;
            dsply 'Divide by zero';
          endmon;

          *inlr = *on;

      /end-free

The DSPLY operations in the above example are for demonstration purposes only. Please do not use DSPLY in a finished program!


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.