code

Name
Astradyne (UK) Ltd
Scriptlanguage
Plain Text
Tabwidth
4
Date
Tue, 20 Mar 2007 16:15:08 +0000
IP
192.168.0.35

Traditionally most programmers tend to use conditioning indicators within their display file DDS to control the use of attributes such as colour, reverse image, blink, position cursor, etc. While this is straightforward, it can be cumbersome and cause confusion when debugging your program and there is another way.

By using what are known as P-Fields, you can assign a single character field to an input or output field on your display file and then assign the P-field the hexadecimal attribute value that you want to assign the field. The example code below shows how to assign and use P-fields.

  1. DDS SNIPPET
  2. ===========
  3.     A            MYFLD        79A  O  3  2
  4.     A                                      DSPATR(&MYFLDATR)
  5.     A            MYFLDATR      1A  P
  6.  
  7.  
  8. RPG IV ATTRIBUTE CONSTANTS
  9. ==========================
  10.     D* White                                         
  11.     D Wht            C                  CONST(X'22')
  12.     D WhtUnd          C                  CONST(X'26')
  13.     D WhtRev          C                  CONST(X'23')
  14.     D WhtRevSep      C                  CONST(X'33')
  15.                                                      
  16.     D* Green                                         
  17.     D Grn            C                  CONST(X'20')
  18.     D GrnRev          C                  CONST(X'21')
  19.     D GrnUnd          C                  CONST(X'24')
  20.     D GrnUndRev      C                  CONST(X'25')
  21.                                                      
  22.     D* Red                                           
  23.     D Red            C                  CONST(X'28')
  24.     D RedRev          C                  CONST(X'29')
  25.     D RedHi          C                  CONST(X'2A')
  26.     D RedHiRev        C                  CONST(X'2B')
  27.     D RedUnd          C                  CONST(X'2C')
  28.     D RedUndRev      C                  CONST(X'2D')
  29.     D RedUndBln      C                  CONST(X'2E')
  30.                                                        
  31.     D* Turquoise (CS by default)                     
  32.     D Trq            C                  CONST(X'30')
  33.     D TrqRev          C                  CONST(X'31')
  34.     D TrqUnd          C                  CONST(X'34')
  35.     D TrqUndRev      C                  CONST(X'35')
  36.                                                        
  37.       * Yellow (CS by default)                         
  38.     D Ylw            C                  CONST(X'B2')
  39.     D YlwRev          C                  CONST(X'B3')
  40.     D YlwUnd          C                  CONST(X'B6')
  41.                                                        
  42.     D* Pink                                           
  43.     D Pnk            C                  CONST(X'38')
  44.     D PnkRev          C                  CONST(X'39')
  45.     D PnkUnd          C                  CONST(X'3C')
  46.     D PnkUndRev      C                  CONST(X'3D')
  47.                                                        
  48.     D* Blue                                           
  49.     D Blu            C                  CONST(X'3A')
  50.     D BluRev          C                  CONST(X'3B')
  51.     D BluUnd          C                  CONST(X'3E')
  52.                                                      
  53.                                                      
  54. RPG IV USAGE EXAMPLE
  55. ====================
  56.     C* Set the field to Red + Reverse Image...       
  57.     C                  Eval      MyFldAtr = RedRev 
  58.  
  59.