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.
This was first published in October 2005