I've display file in RPGLE program...
I want to display function key F19=View History based on certain condition. I planned to use indicator to swith on if the condion meets and the option will be displayed ...
the problem here is all 01 to 99 indicators, KC,KE,KG,KJ,KQ,U2 are already used by the program.
how to condition the display option in this situation?
Software/Hardware used:
AS400
ASKED:
October 13, 2009 7:23 PM
UPDATED:
October 26, 2009 4:18 PM
The only indicator that seems to be needed is one that enables the CA19 or CF19 F-key in the record format. Since the conditions already seem to be known in the program, any conditioning indicator(s) also would be known already. What do you need to use an indicator for? You don’t need one to display the [F19=View History] text — that can be done simply by populating a field with either blanks or the text, or perhaps with DSPATR(&P-field).
Or do you need to come up with a new set of resulting indicators in the program?
The real answer is to start getting rid of any indicators going to the screen and being used in the program. Except for a few subfile keywords, no other indicators are required. And numbered indicators in the program can be mostly eliminated, either by using %bifs or by substituting named indicator fields.
Surely you can find a couple indicators that are used in only a couple program instructions and eliminate them. Once replaced by code that doesn’t need a resulting/conditioning indicator, the previously used indicator can be used for your CA19 conditioning.
Tom
Sheesh – I once had a programmer ‘who ran out of indicators’
your logic generally only needs one, file and diplay conditions a few more
time to do surgery on the program.
Don’t use indicators for your function keys, use the AID field in the DSPF INFDS.
Thank you so much guys…
I’was trying to add new funtionality in existing huge program…
i identified some existing chain operations in the program where i can replace indicators with %found()
plus i tried to use H and U indicators in display file to make the field ND but AS400 didnt like it so i cudnt…
I’m really afraid of doing surgery to that existing huge and infamous program so
next I’m planning to try some non-indicator logic which I’m totally unaware of…
Thanks once again!!!
-NG
…i tried to use H and U indicators in display file to make the field ND…
Review a DDS manual for display files for the DSPATR keyword. In particular, look at the DSPATR(&program-to-system-field) option. You don’t need an indicator to condition non-display (nor most other attributes). You define a hidden program-to-system field and put the hex attribute value into it when you write the display. For non-display, the P-field value is given as x’27′ in the DDS manual. No indicator needed.
Alternatively, you simply pass the text to the display in an output field. When you want it to show up, you put the text in the field. When you don’t want it to show up, put blanks in the field.
Tom
A technique I’ve used on occaision uses no indicators at all.
Define a text field to the length of your text (so 16 is fine for your example). Reset it to blanks and then fill it with “F19 …” if your history criteria is met (before rendering the screen, of course).
Downside is it might not support use as a hot key (all of my iSeries users do this via an “F” key anyway).
Mike L.
Something else you can do is create your own indicator. For example:
D VALID_FIELD S N INZ(*OFF)