Difference between revisions of "Program To System Fields"

From MidrangeWiki
Jump to: navigation, search
m (minor readability edit)
(Introduction To P Fields)
 
(One intermediate revision by the same user not shown)
Line 3: Line 3:
 
= Program To System Fields =
 
= Program To System Fields =
 
== Introduction To P Fields ==
 
== Introduction To P Fields ==
Program to system fields (referenced from here out as P fields) can be used to emphasize field data on display files.   
+
Program-to-system fields (referenced from here out as P-fields) can be used to emphasize field data in display files.   
  
These can be used as an alternative to using indicator controlled display attributes.   
+
They are an alternative to using indicator controlled display attributes.   
  
P fields are one-byte codes passed to the display file at run-time. 
+
Indicator controlled attributes are determined at compile time, while P fields are evaluated at run-time, allowing
 +
dynamic updating of display fields.
 +
 
 +
To use the P-field attributes, a display file field must contain the DSPATR keyword referencing the P-field:
  
Indicator controlled attributes must be determined at compile time. 
 
  
In order to utilize the P field attributes the display file must contain a field that is one byte character for the field you wish to alter attributes for.
 
 
<pre>
 
<pre>
 
A            myfield      20A  B 10  6DSPATR(&fldattr)
 
A            myfield      20A  B 10  6DSPATR(&fldattr)
 
A            fldattr        1A  P
 
A            fldattr        1A  P
 
</pre>
 
</pre>
So if you wished to display the contents of <i>myfield</i> in Red with underlines, you could do so by using the following code in your RPG program.
+
E.g. to display the contents of <i>myfield</i> underlined in red, use the following code:
 
<pre>
 
<pre>
 
/free
 
/free

Latest revision as of 18:16, 18 February 2016

Program To System Fields

Introduction To P Fields

Program-to-system fields (referenced from here out as P-fields) can be used to emphasize field data in display files.

They are an alternative to using indicator controlled display attributes.

Indicator controlled attributes are determined at compile time, while P fields are evaluated at run-time, allowing dynamic updating of display fields.

To use the P-field attributes, a display file field must contain the DSPATR keyword referencing the P-field:


A            myfield       20A  B 10  6DSPATR(&fldattr)
A            fldattr        1A  P

E.g. to display the contents of myfield underlined in red, use the following code:

/free
   fldattr=x'2C';
/end-free

For a good write-up on P fields & their usage Click Here!

Program To System Fields List

Here is a work-in-progress list of constant names for the various program-to-system field values (also known as P Fields):

Attributes Hexadecimal Value
Green x'20'
Green/Reverse Image x'21'
White x'22'
White/Reverse Image x'23'
Green/Underlined x'24'
Green/Underlined/Reverse Image x'25'
White/Underlined x'26'
Non-Display x'27'
Red x'28'
Red/Reverse Image x'29'
Red/Highlighted x'2A'
Red/Highlighted/Reverse Image x'2B'
Red/Underlined x'2C'
Red/Underlined/Reverse Image x'2D'
Red/Underlined/Blinking x'2E'
Non-display x'2F'
Turquoise/Column Separators x'30'
Turquoise/Column Separators/Reverse Image x'31'
Yellow/Column Separators x'32'
White/Reverse Image/Column Separators x'33'
Turquoise/Underlined/Column Separators x'34'
Turquoise/Underlined/Column Separators/Reverse Image x'35'
Yellow/Underlined/Column Separators x'36'
Non-display x'37'
Pink x'38'
Pink/Reverse Image x'39'
Blue x'3A'
Blue/Reverse Image x'3B'
Pink/Underlined x'3C'
Pink/Underlined/Reverse Image x'3D'
Blue/Underlined x'3E'
Non-display x'3F'
Protected Fields
Green x'A0'
Green/Reverse Image x'A1'
White x'A2'
White/Reverse Image x'A3'
Green/Underlined x'A4'
Green/Underlined/Reverse Image x'A5'
White/Underlined x'A6'
Non-display x'A7'
Red x'A8'
Red/Reverse Image x'A9'
Red/Highlighted x'AA'
Red/Highlighted/Reverse Image x'AB'
Red/Underlined x'AC'
Red/Underlined/Reverse Image x'AD'
Red/Underlined/Blinking x'AE'
Non-display x'AF'
Turquoise/Column Separators x'B0'
Turquoise/Column Separators/Reverse Image x'B1'
Yellow/Column Separators x'B2'
White/Column Separators/Reverse Image x'B3'
Turquoise/Column Separators/Underlined x'B4'
Turquoise/Column Separators/Reverse Image/Underlined x'B5'
Yellow/Column Separators/Underlined x'B6'
Non-display x'B7'
Pink x'B8'
Pink/Reverse Image x'B9'
Blue x'BA'
Blue/Reverse Image x'BB'
Pink/Underlined x'BC'
Pink/Underlined/Reverse Image x'BD'
Blue/Underlined x'BE'
Non-display x'BF'


Sample Data Structure Definition


      /DEFINE PFIELDS
      *---------------------------------------------------------------------
      * Valid P-field values
      *---------------------------------------------------------------------
     D PFIELDSDS       DS
     D @GRN                           1A   Inz(x'20')
     D @GRN_RI                        1A   Inz(x'21')
     D @WHT                           1A   Inz(x'22')
     D @WHT_RI                        1A   Inz(x'23')
     D @GRN_UL                        1A   Inz(x'24')
     D @GRN_UL_RI                     1A   Inz(x'25')
     D @WHT_UL                        1A   Inz(x'26')
     D @ND                            1A   Inz(x'27')
     D @RED                           1A   Inz(x'28')
     D @RED_RI                        1A   Inz(x'29')
     D @RED_HI                        1A   Inz(x'2A')
     D @RED_HI_RI                     1A   Inz(x'2B')
     D @RED_UL                        1A   Inz(x'2C')
     D @RED_UL_RI                     1A   Inz(x'2D')
     D @RED_UL_BL                     1A   Inz(x'2E')
     D @ND_2F                         1A   Inz(x'2F')
     D @TRQ_CS                        1A   Inz(x'30')
     D @TRQ_CS_RI                     1A   Inz(x'31')
     D @YLW_CS                        1A   Inz(x'32')
     D @WHT_RI_CS                     1A   Inz(x'33')
     D @TRQ_UL_CS                     1A   Inz(x'34')
     D @TRQ_UL_RI_CS                  1A   Inz(x'35')
     D @YLW_UL_CS                     1A   Inz(x'36')
     D @ND_37                         1A   Inz(x'37')
     D @PNK                           1A   Inz(x'38')
     D @PNK_RI                        1A   Inz(x'39')
     D @BLU                           1A   Inz(x'3A')
     D @BLU_RI                        1A   Inz(x'3B')
     D @PNK_UL                        1A   Inz(x'3C')
     D @PNK_UL_RI                     1A   Inz(x'3D')
     D @BLU_UL                        1A   Inz(x'3E')
     D @ND_3F                         1A   Inz(x'3F')
      *
      * Protected fields
      *
     D @PGRN                          1A   Inz(x'A0')
     D @PGRN_RI                       1A   Inz(x'A1')
     D @PWHT                          1A   Inz(x'A2')
     D @PWHT_RI                       1A   Inz(x'A3')
     D @PGRN_UL                       1A   Inz(x'A4')
     D @PGRN_UL_RI                    1A   Inz(x'A5')
     D @PWHT_UL                       1A   Inz(x'A6')
     D @PND                           1A   Inz(x'A7')
     D @PRED                          1A   Inz(x'A8')
     D @PRED_RI                       1A   Inz(x'A9')
     D @PRED_HI                       1A   Inz(x'AA')
     D @PRED_HI_RI                    1A   Inz(x'AB')
     D @PRED_UL                       1A   Inz(x'AC')
     D @PRED_UL_RI                    1A   Inz(x'AD')
     D @PRED_UL_BL                    1A   Inz(x'AE')
     D @ND_AF                         1A   Inz(x'AF')
     D @PTRQ_CS                       1A   Inz(x'B0')
     D @PTRQ_CS_RI                    1A   Inz(x'B1')
     D @PYLW_CS                       1A   Inz(x'B2')
     D @PWHT_RI_CS                    1A   Inz(x'B3')
     D @PTRQ_UL_CS                    1A   Inz(x'B4')
     D @PTRQ_UL_RI_CS                 1A   Inz(x'B5')
     D @PYLW_UL_CS                    1A   Inz(x'B6')
     D @ND_B7                         1A   Inz(x'B7')
     D @PPNK                          1A   Inz(x'B8')
     D @PPNK_RI                       1A   Inz(x'B9')
     D @PBLU                          1A   Inz(x'BA')
     D @PBLU_RI                       1A   Inz(x'BB')
     D @PPNK_UL                       1A   Inz(x'BC')
     D @PPNK_UL_RI                    1A   Inz(x'BD')
     D @PBLU_UL                       1A   Inz(x'BE')
     D @ND_BF                         1A   Inz(x'BF')
     D PFIELDS                 1     64A
     D PFIELD                         1A   Dim(64) Overlay(PFIELDS)