Return to the DDS Tips
Program-to-file attribute fields by Nelson Smith
From the RPG-L Mailing List . They are very easy to work with once you get familiar with them. You set up a 1-byte character field in your DDS for each displayable field that you want to control. It's like a hidden field, except you use a type of 'P' rather than 'H'. Then you associate it with the displayable field by use of the DSPATR keyword. Instead of using RI or HI or any of those attribute tags you would normally use, you just use the Program-to-File field name (along with an ampersand like in CL). i.e. A ATTR_NAME 1A P A DATA_NAME 30A B 10 1DSPATR(&ATTR_NAME) Instead of setting indicators in your program, you simply move various hex-codes into the attribute field for whatever attribute you want. Now all attribute control resides in your program, and is much more readable. I set up the hex codes as constants in a copy member and just copy them into all my programs as one of many standard include members. Here are some of the hex codes I use: D ND C CONST( X'27' ) D PR_ND C CONST( X'A7' ) D Normal C CONST( X'20' ) D PR_Normal C CONST( X'A0' ) D RI C CONST( X'21' ) D PR_RI C CONST( X'A1' ) D HI C CONST( X'22' ) D HI_RI C CONST( X'23' ) D PR_HI C CONST( X'A2' ) D PR_HI_RI C CONST( X'A3' ) D UL C CONST( X'24' ) D UL_RI C CONST( X'25' ) D UL_HI C CONST( X'26' ) D PR_UL C CONST( X'A4' ) D PR_UL_RI C CONST( X'A5' ) D PR_UL_HI C CONST( X'A6' ) D BL C CONST( X'28' ) D BL_RI C CONST( X'29' ) D BL_HI C CONST( X'2A' ) D BL_HI_RI C CONST( X'2B' ) D BL_UL C CONST( X'2C' ) D BL_UL_RI C CONST( X'2D' ) D BL_UL_HI C CONST( X'2E' ) D PR_BL C CONST( X'A8' ) D PR_BL_RI C CONST( X'A9' ) D PR_BL_HI C CONST( X'AA' ) D PR_BL_HI_RI C CONST( X'AB' ) D PR_BL_UL C CONST( X'AC' ) D PR_BL_UL_RI C CONST( X'AD' ) D PR_BL_UL_HI C CONST( X'AE' ) *** COLORS *** D White C CONST( X'22' ) D White_UL C CONST( X'26' ) D White_RI C CONST( X'23' ) D White_RI_CS C CONST( X'33' ) D PR_White C CONST( X'A2' ) D PR_White_UL C CONST( X'A6' ) D PR_White_RI C CONST( X'A3' ) D PR_White_RI_CS C CONST( X'B3' ) D Green C CONST( X'20' ) D Green_RI C CONST( X'21' ) D Green_UL C CONST( X'24' ) D Green_UL_RI C CONST( X'25' ) D PR_Green C CONST( X'A0' ) D PR_Green_RI C CONST( X'A1' ) D PR_Green_UL C CONST( X'A4' ) D PR_Green_UL_RI C CONST( X'A5' ) D Red C CONST( X'28' ) D Red_RI C CONST( X'29' ) D Red_HI C CONST( X'2A' ) D Red_HI_RI C CONST( X'2B' ) D Red_UL C CONST( X'2C' ) D Red_UL_RI C CONST( X'2D' ) D Red_UL_BL C CONST( X'2E' ) D PR_Red C CONST( X'A8' ) D PR_Red_RI C CONST( X'A9' ) D PR_Red_HI C CONST( X'AA' ) D PR_Red_HI_RI C CONST( X'AB' ) D PR_Red_UL C CONST( X'AC' ) D PR_Red_UL_RI C CONST( X'AD' ) D PR_Red_UL_BL C CONST( X'AE' ) D Turq_CS C CONST( X'30' ) D Turq_CS_RI C CONST( X'31' ) D Turq_UL_CS C CONST( X'34' ) D Turq_UL_RI_CS C CONST( X'35' ) D PR_Turq_CS C CONST( X'B0' ) D PR_Turq_CS_RI C CONST( X'B1' ) D PR_Turq_CS_UL C CONST( X'B4' ) D PR_Turq_CSULRI C CONST( X'B5' ) D Yellow_CS C CONST( X'32' ) D Yellow_CS_UL C CONST( X'36' ) D PR_Yellow_CS C CONST( X'B2' ) D PR_Yellow_CSUL C CONST( X'B6' ) D Pink C CONST( X'38' ) D Pink_RI C CONST( X'39' ) D Pink_UL C CONST( X'3C' ) D Pink_UL_RI C CONST( X'3D' ) D PR_Pink C CONST( X'B8' ) D PR_Pink_RI C CONST( X'B9' ) D PR_Pink_UL C CONST( X'BC' ) D PR_Pink_UL_RI C CONST( X'BD' ) D Blue C CONST( X'3A' ) D Blue_RI C CONST( X'3B' ) D Blue_UL C CONST( X'3E' ) D PR_Blue C CONST( X'BA' ) D PR_Blue_RI C CONST( X'BB' ) D PR_Blue_UL C CONST( X'BE' )
[report a broken link by clicking here]