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

$

Book Reviews

Resource Center

  •  

  • LANSA Business users want new applications now. Market and regulatory pressures require faster application updates and delivery into production. Your IBM i developers may be approaching retirement, and you see no sure way to fill their positions with experienced developers. In addition, you may be caught between maintaining your existing applications and the uncertainty of moving to something new.

  • The MC Resource Centers bring you the widest selection of white papers, trial software, and on-demand webcasts for you to choose from. >> Review the list of White Papers, Trial Software or On-Demand Webcast at the MC Press Resource Center. >> Add the items to yru Cart and complet he checkout process and submit

  • SB Profound WC 5536Join us for this hour-long webcast that will explore:

  • Fortra IT managers hoping to find new IBM i talent are discovering that the pool of experienced RPG programmers and operators or administrators with intimate knowledge of the operating system and the applications that run on it is small. This begs the question: How will you manage the platform that supports such a big part of your business? This guide offers strategies and software suggestions to help you plan IT staffing and resources and smooth the transition after your AS/400 talent retires. Read on to learn: