Imbedding screen attributes

Is there a way to highlight (or underline, or reverse-image) a portion of a field? The answer is yes -- by defining, and then imbedding, single-character attribute fields. I had a situation where I had a subfile of 70-character text fields. I would build each record in a temporary field and then add it to the subfile. The problem I ran into was that I wanted to reverse-image a portion of some of the subfile records, but not all of them....

Obviously, I couldn't define a screen attribute to accomplish this, so I had to engineer a solution. By using the BITON and BITOFF commands, I was able to logically OR the desired screen attributes into single character fields, and then imbed those single characters anywhere I wanted that attribute to dynamically show. The character itself is invisible on the screen and takes up only one position.


* NORMAL VIDEO   - 20H - 0010 0000                            
* REVERSE IMAGE  - 21H - 0010 0001                            
* HIGH INTENSITY - 22H - 0010 0010                            
* UNDERSCORE     - 24H - 0010 0100                            
* BLINK          - 28H - 0010 1000                            
 *                                                             
 * COMBINATIONS CAN BE ACHIEVED BY LOGICALLY ORing ATTRIBUTES  
 * EXAMPLE:  FOR HIGH INTENSITY/REVERSE IMAGE, COMBINE        
 *      REVERSE IMAGE  - 21H - 0010 0001                       
 *      HIGH INTENSITY - 22H - 0010 0010                       
 *      --------------------------------                       
 *      REVERSE/HIGH   - 23H - 0010 0011                       
 * WHICH IS             BITON '  2    67'                      
 *                                                             
 *                                                             
C                   BITOFF    '01234567'    ATRRI             1
C                   BITON     '257'         ATRRI              
 *                                                             
C                   BITOFF    '01234567'    ATRHB             1
C                   BITON     '246'         ATRHB              
 *                                                             
C                   BITOFF    '01234567'    ATRHI             1
C                   BITON     '26'          ATRHI 

This was first published in February 2001

Dig deeper on RPG iSeries programming

0 comments

Oldest 

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

-ADS BY GOOGLE

SearchEnterpriseLinux

SearchDataCenter

Close