PMS Information Systems
Welcome to PMS Information Systems - IBM i (AS/400) Forum !!!

Get Answers for all your queries on IBM i (AS/400).

Name the Indicators - Tip2

Go down

Name the Indicators - Tip2

Post  maran on Thu Feb 09, 2012 12:05 pm

RPG understands indicators. We don't need to spell everything out

Right from its inception, RPG has understood indicators to be boolean variables that simply equate to true or false. So If *In25 = '1'; is not only ugly--it is a waste of typing because the shorter and, to me at least, more obvious If *In25; is identical in effect.

If validAccount;

Or even:

If *In(validAccount_25);

Are a lot easier to understand then:

If validAccount = '1';

The increased readability shines though when WE consider the negative condition. For example consider how much more obvious:

If Not validAccount;

Is when compared with:

If validAccount = '0';

Perhaps WE never use '1' but use the figurative constants *On and *Off? Isn't that better?

Not a lot really. Although most of us have grown up thinking of indicators as being "On" or "Off", that is a just throwback to the tabulator origins of RPG, where indicators were real physical switches that could indeed be on or off.


Posts : 442
Join date : 2009-07-24

View user profile

Back to top Go down

Back to top

Permissions in this forum:
You cannot reply to topics in this forum