Just like car indicators (or ‘blinkers’ as my American cousins call them) they can be switched *ON or *OFF in a program to indicate the state of a certain piece of logic. In the IBM RPG language, it used to logically flick the switch of a numeric indicator 01-99 to “indicate” that something was happening.
For example, we might switch on indicator 44 to say “invalid customer code” and then in every other place int he code we would say “if *IN44 is *ON then show this message, or print this warning or something”. Thats the end of this stating-the-obvious broadcast.
Using numeric indicators has been frowned upon for years, RPG has evolved and although it still fully supports using the old numeric style indicators, the introduction of alphanumeric ‘indicators’ in programming code makes much more sense. After all, what makes more sense checking a value of *IN66 or checking a value of a field called ItemCodeValid?
We can turn off everything in one simple Clear (or Reset if you set specific indicators *on/*off in *INZSR):
Now saying that, older programs some times use numeric indicators extensively and this is just a neat way of turning off blocks of indicators. SO, lets says we wanted to turn off all indicators higher than 20:
// *IN is a standard RPGLE array for *IN(01) thru *in(99) - and it says turn off all from 21 to 99 %SubArr(*IN : 21 : 99) = *Off;
In older column based RPG (or RPG400) you could use the MOVEA (move array command) turn them all off
C MOVEA *ALL:‘0’ *in01
Or specify a smaller block of indicators:
C MOVEA ‘0000’ *in80
would move *zeros to *in80, *in81, *in82, *in83
Lots of other techniques but I like the %subarr solution.
IBM i Software Developer, Digital Dad, AS400 Anarchist, RPG Modernizer, Alpha Nerd and Passionate Eater of Cheese and Biscuits. Nick Litten Dot Com is a mixture of blog posts that can be sometimes serious, frequently playful and probably down-right pointless all in the space of a day. Enjoy your stay, feel free to comment and in the words of the most interesting man in the world: Stay thirsty my friend.
Simple email validation SQL RPG ILE program
How to use named indicators in RPG
Controlling DSPF color without using indicators
IBM i ACS 5250 EMULATOR FONT – and other ridiculous mumbo jumbo
IBM i SQL statement to convert or compare hundred year date format
How to compare ‘100 Year Date’ to a Timestamp – aka – Weird AS400 iSeries Date formats