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.
Dig deeper on iSeries application development
Related Q&A from John Blenkinsop
When an error occurs on an IBM command, the diagnostic messages are sent first, then an escape message, which you can monitor. On AS/400 you see the ...continue reading
Learn how to 'append data to the file' with the FTP DIR command, and eliminate the hassle of having to end the FTP session and restart to view ...continue reading
RPGIV will 'think of' incoming integer fields as binary, and then will redefine them in the program structures as PACKED. So, when you chain a record...continue reading
Have a question for an expert?
Please add a title for your question
Get answers from a TechTarget expert on whatever's puzzling you.