15,000 line RPG programs shouldn't be allowed; there is always a better way. But I assume that this is a legacy program. If it is ILE, then it is disgraceful!
You can condition a field in a display file without indicators. Create a field in the record format as a 'program-to-system' field ("P" in position 38, size 1 alpha character). Say the field is called P#CUST where the display field you want to control is called D#CUST. It would look like this:
AAN01N02N03T.Name++++++RLen++TDpBLinPosFunction
A P#CUST 1A P
Now add a DSPATR to the field you want to condition :
AAN01N02N03T.Name++++++RLen++TDpBLinPosFunction
A D#CUST 11 B DSPATR(&P#CUST)
In your program, create a hex value for each display attribute you want to use :
C BITON'25' HXOGUS
Green underscore open
C BITON'02' HXPGRN
Green normal protected
HXOGUS is Hex 24, HXPGRN is Hex A0.
Now in your program when you want the field to be open for the user to change its value, set P#CUST to HXOGUS before you EXFMT (or WRITE/READ) the format. It will appear in green and underlined, and the user can change its value.
When you want to protect the field set P#CUST to HXCGRN. Now when you EXFMT the format the field will be in green, without underlines, and protected. No indicators have been used.
Read the OS/400 DDS Reference manual section on valid P-field values for a list of the hex values that are allowed in the program-to-system field.
|