How to Build Advantage CA-COBOL/XE Paint Panels: Arrays

Document ID : KB000056113
Last Modified Date : 14/02/2018
Show Technical Document Details

This is the second of a series of articles that will explain how to build, modify, display, and accept 3270-formatted screen images in Advantage CA-COBOL/XE.

This article will discuss how to define arrays on a PAINT panel to be used by an Advantage CA-COBOL/XE application.

Defining the Array

The Advantage CA-COBOL/XE PAINT facility provides a way of defining one or more arrays on a PAINT panel. An array can be defined horizontally (as a row) or vertically (as a column).

To define an array using the PAINT facility, follow this process:

  • Specify the field name of the first occurrence of the array on the PAINT screen of the PAINT panel.
  • Specify the array details in the DETAIL screen of the PAINT panel.
  • Verify the placement and appearance of the array.

Arrays can be defined on the PAINT screen, or on the PAINT line of the Detail screen. Only the first occurrence of the array needs to be defined on the screen in order to start the process.

Below is an example of a PAINT screen. In this example, we will define multiple occurrences of the 10-byte field labeled PRODUCTS.

                  C'U'S'T'O'M'E'R'''I'N'F'O'R'M'A'T'I'O'N    
                                                             
                                                             
 COMPANY'NAME: ''''''''''''''''''''''''''''''''''''''''''''  
                                                             
 SITE'ID:      ''''''''                                      
                                                             
 PRODUCTS      ''''''''''                                    

Specifying the Array Details

Once the paint field has been laid out on the screen by using single quotes, the array details must be defined. To do this, position the cursor on the paint field associated with PRODUCTS and press PF3. PF3 will bring up the following DETAIL screen:

 PAINT                    Screen Definition Facility                      R3.0.0
        1         2         3         4         5         6         7         8
2345678901234567890123456789012345678901234567890123456789012345678901234567890
PRODUCTS      ''''''''''                                                       
                                                                               
PRODUCTS                                                                       
                                                                               
  Panel: ARRAYPNL  Library: USRIOX  Command: _  Next Row: 01                   
              Current Row: 08                                                  
                                  P P I D                        Occurs        
 Column   -------Field-Name-----  I R N E                      Ver    Hor      
bgn  end                          C T T T                     Ln No  Ln No     
002  009  ______________________  N A L N                     __ __  __ __     
016  025  ______________________  N A L N                     __ __  __ __     

To define the array, enter the field name (Field-Name) that will be referenced by the application program, the length (Ln) and number of occurrences (No) for a vertical (Ver) or horizontal (Hor) array. For a vertical array, the length is the number of blank lines (rows) that will separate each occurrence. For a horizontal array, the length consists of the actual field length plus the number of columns (blank spaces) that will separate each occurrence.

Once the values have been entered, press PF2 to see where each occurrence will appear on the PAINT panel.

Vertical Array

Below is an example of a vertical array. This array defines a field named PRODUCTS-ARRAY that occurs 5 times (No 5) with no blank lines between each occurrence (Ln 01):

PAINT                    Screen Definition Facility                      R3.0.0
        1         2         3         4         5         6         7         8
2345678901234567890123456789012345678901234567890123456789012345678901234567890
PRODUCTS      ''''''''''                                                       
                                                                               
PRODUCTS                                                                       
                                                                               
  Panel: ARRAYPNL  Library: USRIOX  Command: _  Next Row: 01                   
              Current Row: 08                                                  
                                  P P I D                        Occurs        
 Column   -------Field-Name-----  I R N E                      Ver    Hor      
bgn  end                          C T T T                     Ln No  Ln No     
002  009  ______________________  N A L N                     __ __  __ __     
016  025  PRODUCTS-ARRAY          N A L N                     01 05  __ __     

To see how it would display, press the PF2 key. Notice that the first occurrence is identified by single quotes (known as the "space substitute") and all other occurrences are identified with at-symbols (@) (known as the "no-op field separator"):

                  C'U'S'T'O'M'E'R'''I'N'F'O'R'M'A'T'I'O'N          
                                                                   
                                                                   
 COMPANY'NAME: ''''''''''''''''''''''''''''''''''''''''''''        
                                                                   
 SITE'ID:      ''''''''                                            
                                                                   
 PRODUCTS      ''''''''''                                          
               @@@@@@@@@@                                          
               @@@@@@@@@@                                          
               @@@@@@@@@@                                          
               @@@@@@@@@@                                          

Horizontal Array

Below is an example of a horizontal array. This array defines a field named PRODUCTS-ARRAY that occurs 5 times (No 05) with 3 blanks between each occurrence (Ln 13) where 13 = (field length 10 + 3 blanks).

PAINT                    Screen Definition Facility                      R3.0.0
        1         2         3         4         5         6         7         8
2345678901234567890123456789012345678901234567890123456789012345678901234567890
PRODUCTS      ''''''''''   @@@@@@@@@@   @@@@@@@@@@   @@@@@@@@@@   @@@@@@@@@@   
                                                                               
PRODUCTS                                                                       
                                                                               
  Panel: ARRAYPNL  Library: USRIOX  Command: _  Next Row: 01                   
              Current Row: 08                                                  
                                  P P I D                        Occurs        
 Column   -------Field-Name-----  I R N E                      Ver    Hor      
bgn  end                          C T T T                     Ln No  Ln No     
002  009  ______________________  N A L N                     __ __  __ __     
016  025  PRODUCTS-ARRAY          N A L N                     __ __  13 05    

Again, to see how this panel would display, press the PF2 key. Notice that the first occurrence is identified by single quotes (known as the "space substitute") and all other occurrences are identified with at-symbols (@) (known as the "no-op field separator"):

                  C'U'S'T'O'M'E'R'''I'N'F'O'R'M'A'T'I'O'N                       
                                                                                
                                                                                
 COMPANY'NAME: ''''''''''''''''''''''''''''''''''''''''''''                     
                                                                                
 SITE'ID:      ''''''''                                                         
                                                                                
 PRODUCTS      ''''''''''   @@@@@@@@@@   @@@@@@@@@@   @@@@@@@@@@   @@@@@@@@@@   

It's just that simple.

Read More About It

To learn more about painting a panel and assigning field attributes using the PAINT facility, refer to the CA-COBOL/XE PAINT Reference Manual and the CA-COBOL/XE Language Reference Manual.

Contribute Your Ideas

If you have a technique that you would like to share with the Advantage COBOL/XE community as a published article, please contact Advantage CA-COBOL/XE Technical Support.