Naming your numeric indicators used in screen displays or printer files is an effective way to make your programs...
By submitting your email address, you agree to receive emails regarding relevant topic offers from TechTarget and its partners. You can withdraw your consent at any time. Contact TechTarget at 275 Grove Street, Newton, MA.
more readable and understandable, but did you know there are two ways it can be done? The first method is associating a data structure using the INDDS keyword, and the second method is by address association using the BASED keyword.
The first method uses the INDDS keyword which references a data structure. Within the data structure you give each indicator you use a unique name. So instead of saying IF *IN99 = *ON, you can say IF ERROR = *ON. This provides someone who has never been in the program before a better understanding of what the test is, instead of having to hunt down every occurrence of the indicator and figure it out from there.
FWS1234DF CF E WORKSTN INDDS(Indicators) DIndicators DS D InPageUp 25 25N D InPageDown 26 26N D InSflDspctl 40 40N D InSflDsp 41 41N D InSflClr 42 42N D InSflEnd 45 45N D InPC_Run 60 60N D InPC_ChkDt 61 61N D InPC_Cntrl# 62 62N
The keyword INDDS references a data structure named Indicators. The data structure is a length of 99, but you don't need to specify every indicator, only the ones you're using. Additionally, the keyword INDARA needs to be present in the display or printer file you're referencing. The data structure can be referenced by more than one display and/or printer file within the program. You can also create separate ones for each.The second method uses the BASED keyword. It is similar to the first method except it does not require changes to the file specifications or either the display or printer files; all the changes are in the data structure, like so:
DIndicators S * INZ(%Addr(*IN)) D DS BASED(Indicators) D InPageUp 25 25N D InPageDown 26 26N D InSflDspctl 40 40N ...
Here, the built-in function %ADDR references the Indicator array, and BASED references the data structure you provide.
A difference between the two methods is that the first method can refer to a different data structure for each display and/or printer file you use, whereas the second one would apply to all.
Here's an added tip, regardless of which method you use. You are not restricted to one name for each indicator. It is possible to supply multiple names for each. For example if indicator 50 is used to condition a field on two different screens, each with a different meaning, you can specify something like this within the data structure:
D InPosCursor 50 50N D InInvCustomer 50 50N
This way you're not stuck using a name in another part of the program that isn't the intended meaning. A word of caution however, as when you condition one of the named indicators above, it affects both when they're sharing the same indicator within a data structure. As long as this is kept in mind when designing the program, you'll be OK.