>> Geez, yes you're right.  Confusion there.  I tested the procedure called
A1ErrorsExists, returned a '2'.  Resulted in the screen being redisplaying,
thus assuming that the procedure equated to TRUE. 

I'd like to hear Barbara's thoughts on this but ...

Some of the ways in which indicators behave is historical.  Prior to RPG IV,
indicators were simply treated as character fields, there was no real notion
of a boolean.  This changed a bit with RPG IV and the notion of a boolean
(i.e. If Not *IN01) was introduced.  Once named indicators (type N) were
added, they had to basically equate to the same thing.  

When developing RPG IV it was discovered that many people were abusing
indicators and placing values other than '1' and '0' in them!  For most (but
not all) conditions this worked in RPG III (i.e. anything other than
character "0" was *On).  RPG IV was supposed to be more consistent and only
treat '1' as *On and '0' as *Off - but that may not have happened in the
end.  Hopefully it was at least consistent!

So - saying Return '0' will work fine if the return value is an indicator.
Returning a constant with the value *On (which is effectively a character
field) is OK too.  But if you want to return a boolean you have to define it
as such - and there is no such option with a constant.

As I said earlier - within the context of the code itself it makes much more
sense to return success or return fail.  If in the caller you want to say
"If not myprocedure();" where myprocedure returns an indicator, or "If
myprocedure() <> successful" it will work just fine.  


Jon Paris
Partner400

www.Partner400.com
www.RPGWorld.com 


As an Amazon Associate we earn from qualifying purchases.

This thread ...


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.