Graphic host variables in COBOL applications that use SQL

Graphic host variables are only supported in ILE COBOL for iSeries™.

There are two valid forms of graphic host variables:
  • Fixed-Length Graphic Strings
  • Varying-Length Graphic Strings

Fixed-length graphic strings

Read syntax diagramSkip visual syntax diagram
>>-+-01------+--variable-name----------------------------------->
   +-77------+                  
   '-level-1-'                  

                .-IS-.                   
>--+-PICTURE-+--+----+--picture-string-------------------------->
   '-PIC-----'                           

            .-IS-.                
   .-USAGE--+----+-.              
>--+---------------+--DISPLAY-1--------------------------------->

>--+--------------------------------+-- . ---------------------><
   |        .-IS-.                  |        
   '-VALUE--+----+--string-constant-'        

Notes:
  1. The picture string associated with these forms must be G(m) (or GGG...G, with m instance of G) or N(m) (or NNN...N, with m instance of N) with 1 ≤ m ≤ 16 383.
  2. level-1 indicates a COBOL level between 2 and 48.

Varying-length graphic strings

Read syntax diagramSkip visual syntax diagram
>>-+-01------+--variable-name-- . ------------------------------>
   '-level-1-'                       

                           .-IS-.                     
>--49--var-1--+-PICTURE-+--+----+--picture-string-1------------->
              '-PIC-----'                             

            .-IS-.                          
   .-USAGE--+----+-.                        
>--+---------------+--+-BINARY----------+----------------------->
                      +-COMPUTATIONAL-4-+   
                      '-COMP-4----------'   

>--+---------------------------------+-- . --------------------->
   |        .-IS-.                   |        
   '-VALUE--+----+--numeric-constant-'        

                           .-IS-.                     
>--49--var-2--+-PICTURE-+--+----+--picture-string-2------------->
              '-PIC-----'                             

            .-IS-.                
   .-USAGE--+----+-.              
>--+---------------+--DISPLAY-1--------------------------------->

>--+--------------------------------+-- . ---------------------><
   |        .-IS-.                  |        
   '-VALUE--+----+--string-constant-'        

Notes:
  1. The picture-string-1 associated with these forms must be S9(m) or S9...9 with m instances of 9. m must be from 1 to 4.

    Note that the database manager will use the full size of the S9(m) variable even though COBOL on the iSeries only recognizes values up to the specified precision. This can cause data truncation errors when COBOL statements are being run and may effectively limit the maximum length of variable-length graphic strings to the specified precision.

  2. The picture-string-2 associated with these forms must be G(m), GG...G with m instances of G, N(m), or NN...N with m instances of N, and with 1 ≤ m ≤ 16 370.
  3. var-1 and var-2 cannot be used as host variables.
  4. level-1 indicates a COBOL level between 2 and 48.