String Highlights
From: Eric Hill To: All
I want to highlight certain characters in a string of data. Has anyone done this? I would like to display select characters within a string in high intensity.
From: James Coolbaugh To: Eric Hill
The only way to highlight the data is by placing the correct screen attribute character before and after the string. However, this requires at least one space before and after the string. Because the AS/400 uses attributes for controlling a field, you must use this technique. To obtain a list of the display attributes, sign on to a terminal by using the "test" key. From there, you can find the display attributes (e.g., hex "20," hex "21," and so on).
From: Douglas Handy To: Eric Hill
This may or may not be possible, depending on your requirements and terminal types. A crucial factor is whether or not you are highlighting complete words- that is, if there is a space on either side of the characters to be highlighted.
Text-mode PC display buffers have an attribute byte for each display position. (The buffer is twice the length of the screen, using alternating pairs of a display character and an attribute.) This enables them to change the color or display attribute of each byte without regard to adjacent positions.
However, the original 5250 data stream design uses a buffer the same length as the screen. Screen attributes are interspersed with the characters to be displayed and affect all characters up to the next display attribute character. It is impossible for a display attribute and a displayable character to occupy the same screen position. (The display attributes are nothing more than the characters in the range of hex "20" through hex "3F." Normally, they only exist at boundaries of fields; but wherever they appear, they have the same effect.)
If you are doing something like text searches where you can highlight complete words, it is quite simple to accomplish what you want. In your output field, you just have to replace the blank preceding the word(s) with the desired display attribute (e.g., hex "21") for high intensity or white, and replace the blank following the word(s) with the display attribute to return to normal (hex "20").
This works regardless of terminal type and even with PCs emulating terminals. If you're working with an input-capable field, you need to translate the attributes back to blanks (hex "40") using XLATE or a similar operation. (Don't try this with input fields on the S/34-the workstation controller doesn't accept it. The S/36 and AS/400 do; I've never tried it on the S/38.)
LATEST COMMENTS
MC Press Online