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



Not quite so... true? :)

A little off but...

%found is translated from the HI indicator being set *Off and not %found being translated from the HI indicator being set *On.


-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Charles Wilt
Sent: Friday, December 06, 2013 11:44 AM
To: RPG programming on the IBM i (AS/400 and iSeries)
Subject: Re: Define field as an indicator in D-specs

False... :)

The RPG reference is quite clear

if <indicator expression>

"The operations controlled by the IF operation are performed when the expression in the indicator-expression operand is true."

Since an indicator by itself is a valid indicator-expression,
myInd = *ON;
if myInd;
dsply 'on=true';
endif;

*ON does indeed mean true. For that matter this works:

if '1';
dsply '1=true';
endif;

I do find it interesting that this doesn't compile:
if *ON;
dsply '*on=true';
endif;

The idea that true=1 and false = 0 is pretty much universal. (Well technically it's really false = 0 and true = not false. But true = 1 is pretty common since binary bits are either on = 1 or off = 0)

Charles




On Fri, Dec 6, 2013 at 1:35 PM, Monnier, Gary <Gary.Monnier@xxxxxxxxx>wrote:

Frankly *ON and *OFF do not equate to true and false except by your
design. They just mean '1' and '0'. You can make this mean anything you
want. Barbara's comment about making them constants was a good one.
Many shops use this technique.

One big issue with many developers for as long as I've been around is
assuming everyone will understand their logic. With some developers
their thinking is quite clear. With others you feel like you have to
take a trip around the world and back then unwind a ball of twine to
figure out what they did.

I suspect IBM will add them eventually. RPG gets more and more like
other languages all the time.

-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx]
On Behalf Of Englander, Douglas
Sent: Friday, December 06, 2013 10:16 AM
To: rpg400-l@xxxxxxxxxxxx
Subject: Re: Define field as an indicator in D-specs


I'm not confused. I don't understand why someone would want to write
more code than they have to.

If people steeped in other languages can't figure out what is meant by
*ON and *OFF, then we, as developers, have bigger issues.

Maybe we should ask IBM to include *TRUE and *FALSE as additional ways
to signify *ON and *OFF.

--
This is the RPG programming on the IBM i (AS/400 and iSeries)
(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.

--
This is the RPG programming on the IBM i (AS/400 and iSeries)
(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.


--
This is the RPG programming on the IBM i (AS/400 and iSeries) (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 ...

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.