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