Hexadecimal Representation for Display File DDS Protect Attribute

Article ID: 11524

Q: Within my display file DDS, I use program-to-system fields to control certain display attributes (e.g., underline, high intensity). I sometimes need to protect fields in a display file. Is there a hexadecimal representation for the protect attribute?

A: Yes and no. The protect attribute of an input field is not really a part of the display attribute byte that precedes every input field (and some output fields) on a 5250 display buffer. Those bytes only have the range of x20-x3F and control the color and other visual attributes, such as underline, but not non-visual attributes like protect.

However, if you use DspAtr(&PgmField) to set the display attribute at runtime, the program field does support dynamically changing the protect status of a field. To protect a field, add x'80' (turn on bit 0) to the visual display attribute. When OS/400 sees a byte in the range of xA0-xBF, it converts it to X20-x3F and also changes the Field Format Word for the input field to cause it to be protected.

So although the 5250 data stream itself does not support setting the protection status in the "display attribute" byte, DDS enables it in the DspAtr(&PgmField) support.

This tip is adapted from a post by Douglas Handy in the RPG Forum on the AS/400 Network.

ProVIP Sponsors

ProVIP Sponsors