TechTalk: Embed Display Attributes in Text Fields

General
Typography
  • Smaller Small Medium Big Bigger
  • Default Helvetica Segoe Georgia Times

The display attribute (DSPATR) keyword is used in DDS to make a field appear in reverse image, in high intensity, underlined, blinking, or some combination of these. IBM doesn't tell you in its manuals that you can change the appearance of only a part of a field.

The trick is to embed display attribute control characters within a text field. IBM calls these control characters P-fields, and you can find a list of them in chapter 3 of the DDS Reference manual (SC41-4712, CD-ROM QBJAUI00).

For example, assume a display file defines a 60-byte character field called MSG (see Figure 13). If MSG contains control characters, portions of MSG will appear with other attributes.

Figure 14 shows one method of accomplishing this. Most of the MSG field appears in normal text, but the contents of the Transaction variable are displayed in high intensity.

- Anthony P. Gerasch

Figure 13: MSG is defined as a 60-byte text field in a display file

A R SCRN1
AMSG 60 O 6 8 Fmydspf cf e workstn
D Transaction s 20
D HI c const(x'22')
D NORMAL c const(x'20')
C eval Transaction = 'loan'
C eval msg='The'+HI+
C %trim(Transaction) + NORMAL +
C 'has not been approved.'

C exfmt scrn1

Figure 14: The word in the Transaction variable appears
in high intensity

BLOG COMMENTS POWERED BY DISQUS

LATEST COMMENTS

Support MC Press Online

$0.00 Raised:
$