× 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.



There is no doubt that one should use monitor on places where failure is
likely to occur and handle that specific error accordingly. But if I want
to guarantee that my RPG program never goes into a MSGW status, I usually
use *pssr. Why wrap the entire main procedure with an ugly monitor opcode
when I can use a *pssr to provide me that guarantee.



"Luke Gerhardt" <lgerhardt@xxxxxxxxx> wrote in message
news:mailman.2500.1285687705.2702.rpg400-l@xxxxxxxxxxxxxxx
But...using monitor/endmon you can handle errors at point of failure and
not just try to end the whole thing 'gracefully' at the first sign of
danger. I don't believe you get any such granularity with *pssr.

/free

// convert potential text field into numeric
monitor;
field_number = field_text;
on-error;
field_number = default_number;
endmon;

// display 132-wide screen
monitor;
open my_display_file;
exfmt wide_screen;
on-error;
call program_to_display_132_screen_error
endmon;

/end-free

I do the second process to call a small RPG program that displays a
warning that the workstation is not configured to display a 132-wide
screen. I don't believe I could do multiple error recovery in-line and
handle specific errors as easily with *pssr, could I? (honest question as
I am not 100% familiar with *pssr)

However, if you stage the monitor/endmon around your whole monolithic
program as you did in your example, then yes, you get none of the real
benefits of the function. You really need to wrap the parts of your code
that need handled with their own monitor blocks.

On 2010/09/28 11:03, rpg400-l-request@xxxxxxxxxxxx wrote:
date: Tue, 28 Sep 2010 09:32:29 -0500
from: "hockchai Lim"<lim.hock-chai@xxxxxxxxxxxxxxx>
subject: Re: Convert from free to fixed

So, instead of using *pssr, you would rather do below in the main
procedure?
For clarity of code, I would rather use *pssr for this. I guess each
person
has his/her own preference:).

/free

// global error monitor
monitor;
//code for main procedure goes here
on-error;
// handle something is wrong somewhere;
endmon;

*inlr = *on;

/end-free



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

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.