TechTip: Display Colors in a 5250 Session

Networking
Typography
  • Smaller Small Medium Big Bigger
  • Default Helvetica Segoe Georgia Times

I see many programmers asking about the proper hex codes to use to display colors in a 5250 session. Also, some people would like to use their own custom colors when commenting their source files. Here are two utilities for manipulating colors.

The first one is a command called COLOR that displays a screen (Figure 1) with all the possible color/column_separator/reverse_image combinations for easy reference. The code is in Figures 2-4.

The second is a command called COLORCOM, which will create a source file with one comment line using each of the color display codes (Figure 5). You can use this source member to copy the lines into a source member in which you wish to add colored comments. The command will let you specify the library/file and member you wish to create. If the member already exists, it will not replace it. I like to create it named "A" in the source file in which I am editing, so it appears first in the list when I prompt for copying in SEU. That code is in Figures 6-8.

Enjoy.


http://www.mcpressonline.com/articles/images/2002/ColorsV6--11190400.jpg

Figure 1: The COLOR command displays a screen with all the color options. (Click images to enlarge.)


/*---------------------------------------------------------*/
/*     DISPLAY COLOR COMBINATIONS                          */
/*     Command Processor:  COLOR                           */
/*---------------------------------------------------------*/
                                                            
        CMD        PROMPT('Display Color combinations')   

Figure 2: The COLOR command source

A                                      DSPSIZ(24 80 *DS3)                
A                                      CA03(03)                          
A                                      PRINT                             
A          R COLORS01                                                    
A                                      CF05(97)                          
A                                      CF09(98)                          
A                                      CF10(99)                          
A                                      KEEP                              
A                                  1  2'COLORS01'                        
A                                      COLOR(BLU)                        
A                                  1 25'  YOUR COMPANY NAME GOES HERE  ' 
A                                      DSPATR(RI)                        
A                                  1 61TIME                              
A                                      COLOR(BLU)                        
A            S1DATE         8Y 0O  1 70EDTWRD('0 /  /    ')              
A                                      COLOR(BLU)                        
A                                  2  2SYSNAME                           
A                                      COLOR(BLU)                        
A                                  2 33'ATTRIBUTE TABLE'                 
A                                      DSPATR(HI)                          
A                                      COLOR(WHT)                          
A            S1JOB         10A  O  2 70COLOR(BLU)                          
A                                  3  1' =================================-
A                                      ===================================-
A                                      ========== '                        
A                                  5  2'Hex'                               
A                                  5  7'Description'                       
A                                      DSPATR(UL)                          
A                                  5 24'Description'                       
A                                  5 42'Hex'                               
A                                  5 47'Description'                       
A                                      DSPATR(UL)                          
A                                  5 64'Description'                       
A            S1HX01         2A  O  6  2COLOR(WHT)                          
A            S1LN01        16A  O  6  6                                    
A            S1LD01        15A  O  6 24                                    
A            S1HX17         2A  O  6 42COLOR(WHT)                          
A            S1LN17        16A  O  6 46                                    
A            S1LD17        15A  O  6 64                                    
A            S1HX02         2A  O  7  2COLOR(WHT)
A            S1LN02        16A  O  7  6          
A            S1LD02        15A  O  7 24          
A            S1HX18         2A  O  7 42COLOR(WHT)
A            S1LN18        16A  O  7 46          
A            S1LD18        15A  O  7 64          
A            S1HX03         2A  O  8  2COLOR(WHT)
A            S1LN03        16A  O  8  6          
A            S1LD03        15A  O  8 24          
A            S1HX19         2A  O  8 42COLOR(WHT)
A            S1LN19        16A  O  8 46          
A            S1LD19        15A  O  8 64          
A            S1HX04         2A  O  9  2COLOR(WHT)
A            S1LN04        16A  O  9  6          
A            S1LD04        15A  O  9 24          
A            S1HX20         2A  O  9 42COLOR(WHT)
A            S1LN20        16A  O  9 46          
A            S1LD20        15A  O  9 64          
A            S1HX05         2A  O 10  2COLOR(WHT)
A            S1LN05        16A  O 10  6          
A            S1LD05        15A  O 10 24          
A            S1HX21         2A  O 10 42COLOR(WHT)
A            S1LN21        16A  O 10 46          
A            S1LD21        15A  O 10 64          
A            S1HX06         2A  O 11  2COLOR(WHT)
A            S1LN06        16A  O 11  6          
A            S1LD06        15A  O 11 24          
A            S1HX22         2A  O 11 42COLOR(WHT)
A            S1LN22        16A  O 11 46          
A            S1LD22        15A  O 11 64          
A            S1HX07         2A  O 12  2COLOR(WHT)
A            S1LN07        16A  O 12  6          
A            S1LD07        15A  O 12 24          
A            S1HX23         2A  O 12 42COLOR(WHT)
A            S1LN23        16A  O 12 46          
A            S1LD23        15A  O 12 64          
A            S1HX08         2A  O 13  2COLOR(WHT)
A            S1LN08        16A  O 13  6          
A            S1LD08        15A  O 13 24          
A            S1HX24         2A  O 13 42COLOR(WHT)
A            S1LN24        16A  O 13 46          
A            S1LD24        15A  O 13 64          
A            S1HX09         2A  O 14  2COLOR(WHT)
A            S1LN09        16A  O 14  6          
A            S1LD09        15A  O 14 24          
A            S1HX25         2A  O 14 42COLOR(WHT)
A            S1LN25        16A  O 14 46          
A            S1LD25        15A  O 14 64          
A            S1HX10         2A  O 15  2COLOR(WHT)
A            S1LN10        16A  O 15  6          
A            S1LD10        15A  O 15 24          
A            S1HX26         2A  O 15 42COLOR(WHT)
A            S1LN26        16A  O 15 46          
A            S1LD26        15A  O 15 64          
A            S1HX11         2A  O 16  2COLOR(WHT)
A            S1LN11        16A  O 16  6          
A            S1LD11        15A  O 16 24          
A            S1HX27         2A  O 16 42COLOR(WHT)
A            S1LN27        16A  O 16 46          
A            S1LD27        15A  O 16 64          
A            S1HX12         2A  O 17  2COLOR(WHT)
A            S1LN12        16A  O 17  6          
A            S1LD12        15A  O 17 24          
A            S1HX28         2A  O 17 42COLOR(WHT)
A            S1LN28        16A  O 17 46          
A            S1LD28        15A  O 17 64          
A            S1HX13         2A  O 18  2COLOR(WHT)
A            S1LN13        16A  O 18  6          
A            S1LD13        15A  O 18 24          
A            S1HX29         2A  O 18 42COLOR(WHT)
A            S1LN29        16A  O 18 46          
A            S1LD29        15A  O 18 64          
A            S1HX14         2A  O 19  2COLOR(WHT)
A            S1LN14        16A  O 19  6          
A            S1LD14        15A  O 19 24          
A            S1HX30         2A  O 19 42COLOR(WHT)
A            S1LN30        16A  O 19 46          
A            S1LD30        15A  O 19 64          
A            S1HX15         2A  O 20  2COLOR(WHT)
A            S1LN15        16A  O 20  6          
A            S1LD15        15A  O 20 24                      
A            S1HX31         2A  O 20 42COLOR(WHT)            
A            S1LN31        16A  O 20 46                      
A            S1LD31        15A  O 20 64                      
A            S1HX16         2A  O 21  2COLOR(WHT)            
A            S1LN16        16A  O 21  6                      
A            S1LD16        15A  O 21 24                      
A            S1HX32         2A  O 21 42COLOR(WHT)            
A            S1LN32        16A  O 21 46                      
A            S1LD32        15A  O 21 64                      
A                                 22  2'RI=Reverse Image'    
A                                      COLOR(BLU)            
A                                 22 19'UL=Underline'        
A                                      COLOR(BLU)            
A                                 22 32'BL=Blink'            
A                                      COLOR(BLU)            
A                                 22 41'CS=Column Separators'
A                                      COLOR(BLU)            
A                                 22 62'VA=Visible Attrb.'   
A                                      COLOR(BLU)            
A                                 22 79' '                                 
A                                 23  1' =================================-
A                                      ===================================-
A                                      =========  '                        
A                                 24  2'F3=Exit'                           
A                                      COLOR(BLU)                          

Figure 3: COLOR display file


      *****************************************************************
      *                                                                
      *             COLORR   Display color combinations                
      *                                                                
      *****************************************************************
      * FILE DESCRIPTIONS:                                             
      *****************************************************************
                                                                       
      * Display File                                                   
     Fcolor     cf   e             workstn                             
     F                                     infds(infds)                
                                                                       
      *****************************************************************
      * TABLES/ARRAYS/DATA STRUCTURES                                  
      *****************************************************************
                                                                       
     D hex             s              1    dim(32)                     
     D txi             s             15    dim(32) ctdata perrcd(1)
                                                                   
      * Program Status Data Structure                              
     D psds          esds                  extname(psds)           
                                                                   
      * Local Data Area                                            
     D lda           euds                  extname(lda)            
                                                                   
      * File Information Data Structure                            
     D infds         e ds                  extname(infds)          
                                                                   
      * Screen display line                                        
     D                 ds                                          
     D w#line                        16                            
     D  w#scat                        1    overlay(w#line)         
     D  w#text                       15    overlay(w#line:2)       
                                                                   
      * Hex code array overlaid with screen fields                
     D                 ds                                          
     D  asc                    1     64                            
     D                                     dim(32)
     D  s1hx01                 1      2           
     D  s1hx02                 3      4           
     D  s1hx03                 5      6           
     D  s1hx04                 7      8           
     D  s1hx05                 9     10           
     D  s1hx06                11     12           
     D  s1hx07                13     14           
     D  s1hx08                15     16           
     D  s1hx09                17     18           
     D  s1hx10                19     20           
     D  s1hx11                21     22           
     D  s1hx12                23     24           
     D  s1hx13                25     26           
     D  s1hx14                27     28           
     D  s1hx15                29     30           
     D  s1hx16                31     32           
     D  s1hx17                33     34           
     D  s1hx18                35     36           
     D  s1hx19                37     38           
     D  s1hx20                39     40           
     D  s1hx21                41     42           
     D  s1hx22                43     44           
     D  s1hx23                45     46           
     D  s1hx24                47     48           
     D  s1hx25                49     50           
     D  s1hx26                51     52           
     D  s1hx27                53     54           
     D  s1hx28                55     56           
     D  s1hx29                57     58           
     D  s1hx30                59     60           
     D  s1hx31                61     62           
     D  s1hx32                63     64           
                                                  
      * Screen text lines with color hex codes    
     D                 ds                         
     D  lin                    1    512           
     D                                     dim(32)
     D  s1ln01                 1     16           
     D  s1ln02                17     32           
     D  s1ln03                33     48
     D  s1ln04                49     64
     D  s1ln05                65     80
     D  s1ln06                81     96
     D  s1ln07                97    112
     D  s1ln08               113    128
     D  s1ln09               129    144
     D  s1ln10               145    160
     D  s1ln11               161    176
     D  s1ln12               177    192
     D  s1ln13               193    208
     D  s1ln14               209    224
     D  s1ln15               225    240
     D  s1ln16               241    256
     D  s1ln17               257    272
     D  s1ln18               273    288
     D  s1ln19               289    304
     D  s1ln20               305    320
     D  s1ln21               321    336
     D  s1ln22               337    352
     D  s1ln23               353    368           
     D  s1ln24               369    384           
     D  s1ln25               385    400           
     D  s1ln26               401    416           
     D  s1ln27               417    432           
     D  s1ln28               433    448           
     D  s1ln29               449    464           
     D  s1ln30               465    480           
     D  s1ln31               481    496           
     D  s1ln32               497    512           
                                                  
      * Screen text lines without color hex codes 
     D                 ds                         
     D  txt                    1    480           
     D                                     dim(32)
     D  s1ld01                 1     15           
     D  s1ld02                16     30           
     D  s1ld03                31     45           
     D  s1ld04                46     60           
     D  s1ld05                61     75           
     D  s1ld06                76     90
     D  s1ld07                91    105
     D  s1ld08               106    120
     D  s1ld09               121    135
     D  s1ld10               136    150
     D  s1ld11               151    165
     D  s1ld12               166    180
     D  s1ld13               181    195
     D  s1ld14               196    210
     D  s1ld15               211    225
     D  s1ld16               226    240
     D  s1ld17               241    255
     D  s1ld18               256    270
     D  s1ld19               271    285
     D  s1ld20               286    300
     D  s1ld21               301    315
     D  s1ld22               316    330
     D  s1ld23               331    345
     D  s1ld24               346    360
     D  s1ld25               361    375
     D  s1ld26               376    390                                     
     D  s1ld27               391    405                                     
     D  s1ld28               406    420                                     
     D  s1ld29               421    435                                     
     D  s1ld30               436    450                                     
     D  s1ld31               451    465                                     
     D  s1ld32               466    480                                     
                                                                            
     D i               s              2  0                                  
     D w#dttm          s             14  0                                  
                                                                            
      *****************************************************************     
      * MAIN:                                                               
      *****************************************************************     
                                                                            
      * Load and Display Screen                                             
     C                   dou       *inkc = *on                              
     C                   write     colors01                             90  
     C                   read      color                                9990
     C                   enddo                                              
                                                                       
     C                   move      *on           *inlr                 
                                                                       
      *****************************************************************
      * *INZSR:  Initialization                                        
      *****************************************************************
                                                                       
     C     *inzsr        begsr                                         
                                                                       
     C                   time                    w#dttm                
     C                   move      w#dttm        s1date                
     C                   movel     @job          s1job                 
                                                                       
     C                   move      '20'          asc(1)                
     C                   move      '21'          asc(2)                
     C                   move      '22'          asc(3)                
     C                   move      '23'          asc(4)                
     C                   move      '24'          asc(5)                
     C                   move      '25'          asc(6)                
     C                   move      '26'          asc(7)                
     C                   move      '27'          asc(8) 
     C                   move      '28'          asc(9) 
     C                   move      '29'          asc(10)
     C                   move      '2A'          asc(11)
     C                   move      '2B'          asc(12)
     C                   move      '2C'          asc(13)
     C                   move      '2D'          asc(14)
     C                   move      '2E'          asc(15)
     C                   move      '2F'          asc(16)
     C                   move      '30'          asc(17)
     C                   move      '31'          asc(18)
     C                   move      '32'          asc(19)
     C                   move      '33'          asc(20)
     C                   move      '34'          asc(21)
     C                   move      '35'          asc(22)
     C                   move      '36'          asc(23)
     C                   move      '37'          asc(24)
     C                   move      '38'          asc(25)
     C                   move      '39'          asc(26)
     C                   move      '3A'          asc(27)
     C                   move      '3B'          asc(28)
     C                   move      '3C'          asc(29)
     C                   move      '3D'          asc(30)
     C                   move      '3E'          asc(31)
     C                   move      '3F'          asc(32)
                                                        
     C                   move      x'20'         hex(1) 
     C                   move      x'21'         hex(2) 
     C                   move      x'22'         hex(3) 
     C                   move      x'23'         hex(4) 
     C                   move      x'24'         hex(5) 
     C                   move      x'25'         hex(6) 
     C                   move      x'26'         hex(7) 
     C                   move      x'27'         hex(8) 
     C                   move      x'28'         hex(9) 
     C                   move      x'29'         hex(10)
     C                   move      x'2A'         hex(11)
     C                   move      x'2B'         hex(12)
     C                   move      x'2C'         hex(13)
     C                   move      x'2D'         hex(14)
     C                   move      x'2E'         hex(15)
     C                   move      x'2F'         hex(16)
     C                   move      x'30'         hex(17)
     C                   move      x'31'         hex(18)
     C                   move      x'32'         hex(19)
     C                   move      x'33'         hex(20)
     C                   move      x'34'         hex(21)
     C                   move      x'35'         hex(22)
     C                   move      x'36'         hex(23)
     C                   move      x'37'         hex(24)
     C                   move      x'38'         hex(25)
     C                   move      x'39'         hex(26)
     C                   move      x'3A'         hex(27)
     C                   move      x'3B'         hex(28)
     C                   move      x'3C'         hex(29)
     C                   move      x'3D'         hex(30)
     C                   move      x'3E'         hex(31)
     C                   move      x'3F'         hex(32)
                                                        
     C                   movea     txi           txt    
                                                                       
     C     1             do        32            i                     
     C                   move      hex(i)        w#scat                
     C                   movel     txt(i)        w#text                
     C                   movel     w#line        lin(i)                
     C                   enddo                                         
                                                                       
     C     einzsr        endsr                                         
      *****************************************************************
** TXI                                                                 
GREEN                                                                  
GREEN,RI                                                               
WHITE                                                                  
WHITE,RI                                                               
GREEN,UL                                                               
GREEN,RI,UL                                                            
WHITE,UL                                                               
NON-DISPLAY                                                            
RED                                                                    
RED,RI                                                                 
RED,BL         
RED,RI,BL      
RED,UL         
RED,RI,UL      
RED,UL,BL      
NON-DISPLAY    
TURQUOISE,CS   
TURQUOISE,RI,CS
YELLOW,CS      
YELLOW,RI,CS   
TURQUOISE,UL,CS
TURQUO,RI,UL,CS
YELLOW,UL,CS   
NON-DISPLAY,CS 
PINK           
PINK,RI        
BLUE           
BLUE,RI        
PINK,UL        
PINK,RI,UL     
BLUE,UL       
NON-DISPLAY,VA

Figure 4: COLOR RPGLE program source

http://www.mcpressonline.com/articles/images/2002/ColorsV6--11190401.jpg

Figure 5: This is the source member created by COLORCOM. You can copy individual lines to your own member to have color comments.


  /*********************************************************************/
  /*                                                                   */
  /*  COLORCOM: CREATE SOURCE MEMBER WITH COLOR COMMENTS               */
  /*            COMMAND PROCESSOR: COLORCOMC                           */
  /*  CRTCMD CMD(COLORCOM) PGM(COLORCOMC)                              */
  /*                                                                   */
  /*********************************************************************/
             CMD        PROMPT('Create color comments member')           
             PARM       KWD(FILE) TYPE(QUALFILE) MIN(1) MAX(1) +         
                          PROMPT('Source File')                          
             PARM       KWD(MEMBER) TYPE(*CHAR) LEN(10) MIN(1) +         
                          MAX(1) PROMPT('Member')                        
 QUALFILE:   QUAL       TYPE(*NAME) LEN(10) RSTD(*NO) MIN(1)             
             QUAL       TYPE(*NAME) LEN(10) RSTD(*NO) PROMPT('Library')  

Figure 6: COLORCOM command


PGM        PARM(&FILELIB &MEMBER)                   
                                                                 
DCL        VAR(&FILELIB) TYPE(*CHAR) LEN(20)        
DCL        VAR(&MEMBER) TYPE(*CHAR) LEN(10)         
                                                                 
DCL        VAR(&LIBRARY) TYPE(*CHAR) LEN(10)        
DCL        VAR(&FILE) TYPE(*CHAR) LEN(10)           
                                                                 
CHGVAR     VAR(&LIBRARY) VALUE(%SST(&FILELIB 11 10))
CHGVAR     VAR(&FILE) VALUE(%SST(&FILELIB 1 10))    
                                                                
             ADDPFM     FILE(&LIBRARY/&FILE) MBR(&MEMBER) +     
                          TEXT('Color Comments for copying')    
             MONMSG     MSGID(CPF0000) EXEC(GOTO CMDLBL(ENDPGM))
                                                                   
OVRDBF     FILE(QRPGSRC) TOFILE(&LIBRARY/&FILE) +   
                          MBR(&MEMBER)                           
CALL       PGM(COLORCOMR)                           
DLTOVR     FILE(QRPGSRC)                            
                                                                 
ENDPGM:     ENDPGM                                              

Figure 7: CLP program COLORCOMC


fqrpgsrc   o    e             disk                        
f                                     rename(qrpgsrc:fmt1)
                                                               
dsrcdta           ds            80                        
d hexcod                 05     05                        
d fmtc                   06     06    inz(' ')            
d astk1                  07     16    inz('**********')   
d deccod                 18     19                        
d astk2                  21     30    inz('**********')   
                                                               
c                   eval      hexcod=x'20'                
c                   eval      deccod='20'                 
c                   exsr      record                      
c                   eval      hexcod=x'21'                
c                   eval      deccod='21'                 
c                   exsr      record                      
c                   eval      hexcod=x'22'                
c                   eval      deccod='22'                 
c                   exsr      record                      
c                   eval      hexcod=x'23'
c                   eval      deccod='23' 
c                   exsr      record      
c                   eval      hexcod=x'24'
c                   eval      deccod='24' 
c                   exsr      record      
c                   eval      hexcod=x'25'
c                   eval      deccod='25' 
c                   exsr      record      
c                   eval      hexcod=x'26'
c                   eval      deccod='26' 
c                   exsr      record      
c                   eval      hexcod=x'27'
c                   eval      deccod='27' 
c                   exsr      record      
c                   eval      hexcod=x'28'
c                   eval      deccod='28' 
c                   exsr      record      
c                   eval      hexcod=x'29'
c                   eval      deccod='29' 
c                   exsr      record      
c                   eval      hexcod=x'2A'
c                   eval      deccod='2A' 
c                   exsr      record      
c                   eval      hexcod=x'2B'
c                   eval      deccod='2B' 
c                   exsr      record      
c                   eval      hexcod=x'2C'
c                   eval      deccod='2C' 
c                   exsr      record      
c                   eval      hexcod=x'2D'
c                   eval      deccod='2D' 
c                   exsr      record      
c                   eval      hexcod=x'2E'
c                   eval      deccod='2E' 
c                   exsr      record      
c                   eval      hexcod=x'2F'
c                   eval      deccod='2F' 
c                   exsr      record      
c                   eval      hexcod=x'30'
c                   eval      deccod='30' 
c                   exsr      record      
c                   eval      hexcod=x'31'
c                   eval      deccod='31' 
c                   exsr      record      
c                   eval      hexcod=x'32'
c                   eval      deccod='32' 
c                   exsr      record      
c                   eval      hexcod=x'33'
c                   eval      deccod='33' 
c                   exsr      record      
c                   eval      hexcod=x'34'
c                   eval      deccod='34' 
c                   exsr      record      
c                   eval      hexcod=x'35'
c                   eval      deccod='35' 
c                   exsr      record      
c                   eval      hexcod=x'36'
c                   eval      deccod='36' 
c                   exsr      record      
c                   eval      hexcod=x'37'
c                   eval      deccod='37' 
c                   exsr      record      
c                   eval      hexcod=x'38'
c                   eval      deccod='38' 
c                   exsr      record      
c                   eval      hexcod=x'39'
c                   eval      deccod='39' 
c                   exsr      record      
c                   eval      hexcod=x'3A'
c                   eval      deccod='3A' 
c                   exsr      record      
c                   eval      hexcod=x'3B'
c                   eval      deccod='3B' 
c                   exsr      record      
c                   eval      hexcod=x'3C'
c                   eval      deccod='3C' 
c                   exsr      record      
c                   eval      hexcod=x'3D'
c                   eval      deccod='3D' 
c                   exsr      record              
c                   eval      hexcod=x'3E'        
c                   eval      deccod='3E'         
c                   exsr      record              
c                   eval      hexcod=x'3F'        
c                   eval      deccod='3F'         
c                   exsr      record              
                                                       
c                   move      *on           *inlr 
                                                       
c     record        begsr                         
c                   add       1             srcseq
c                   write     fmt1                
c                   endsr                         


Figure 8: RPGLE program COLORCOMR

Dan Stephens works for Rock-Tenn Company in Norcross, GA and has been working on IBM midrange computers since the System/36 days. Many of those years, he was writing middleware for programmer productivity and system management for the iSeries.

BLOG COMMENTS POWERED BY DISQUS

LATEST COMMENTS

Support MC Press Online

$0.00 Raised:
$