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



On 12/6/2013 2:59 PM, Jon Paris wrote:
That is certainly the case in PHP for example, but if I recall correctly there are certainly situations in RPG where non '1' values will evaluate to false - but not a good idea to rely on it I'm sure but ... I just recall having to try to understand code where someone had set an indicator to either '1', 'A', or 'B' or some such.

Just ran a quick test and that appears to hold true for the current version of RPG IV - so in most cases at least RPG appears to be the reverse. i.e. True = 1 and False = not 'True.


RPG isn't consistent though. Both DSPLYs are done in this program, so it's both false and true.

D fld s 10a inz('a')
C move fld *in10
C 10'cond t' dsply
C N10'ncond t' dsply
C return

Many languages specifically define that 0 is false and anything else is true. But for RPG, it's undefined what will happen if an indicator doesn't have the value '0' or '1'.

With RPG, since it's undefined behaviour, the compiler is free to generate code to compare the indicator to either '0' or '1' depending on which makes more sense for that specific case.


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.