× 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 see what you mean, Barbara. Currently all of the user condition handlers pass 0 to the longJmp procedure so they will always return 1 on the setJmp procedure, but someone could change that in the future without knowing the effects.

I will have to think about how to deal with the flaw, as this code is in several hundred, if not thousands, of programs and procedures.

I will defiantly put a note in the condition handlers about this flaw though.


Thank you
Duane Christen


--


Duane Christen
Senior Software Engineer
(319) 790-7162
Duane.Christen@xxxxxxxxxx

Visit PAETEC.COM


-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Barbara Morris
Sent: Monday, October 04, 2010 1:53 PM
To: rpg400-l@xxxxxxxxxxxx
Subject: Re: Convert from free to fixed

On 2010/10/4 10:42 AM, Christen, Duane wrote:
I have done "retry" logic maybe 3 times in the last 10-15 years with a
condition handler. The way I've done it is with the C functions
setJmp, longJmp.

I have had no discernable problems, but if someone sees a flaw in my
logic (below) I would appreciate a heads up.

When initializing the program/procedure If setJmp(jumpPoint) = 1; //
jump to this point, from the condition handler
// after the condition is handled and the exception
// message information is loaded into the error structure.
de-register condition handler
Return;
EndIf;


It seems like it would be safer to code it like this, to make sure you don't handle a return code of say 2 the same as you would handle the zero case:
rc = setJmp(jumpPoint);
if rc = 1;
. . . what you have now
elseif rc <> 0;
. . . unexpected return code
endif;

I haven't thought before about the way the longjmp() jumps into the middle of the statement containing the setjmp(). I don't know what would happen if you coded something like "if setjmp(jumpPoint) = complex_expression", and complex_expression was evaluated by the compiler before the setjmp. I don't know whether the "if" statement would work correctly after the longjmp().
--
This is the RPG programming on the IBM i / System i (RPG400-L) mailing list To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives at http://archive.midrange.com/rpg400-l.


As an Amazon Associate we earn from qualifying purchases.

This thread ...

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.