Host structure array in COBOL applications that use SQL

The following figures show the syntax for valid host structure array declarations.

Read syntax diagramSkip visual syntax diagram
                                              .-TIMES-.      
>>-level-1--variable-name--OCCURS--dimension--+-------+--.------>

   .----------------------------------------------------------------------------.   
   V                                .-IS-.                                      |   
>----level-2--var-1--+-+-PICTURE-+--+----+--picture-string-1--usage-clause--.-+-+-><
                     | '-PIC-----'                                            |     
                     +-floating-point--.--------------------------------------+     
                     +-.--varchar-string--.-----------------------------------+     
                     +-.--vargraphic-string--.--------------------------------+     
                     +-lob--.-------------------------------------------------+     
                     +-datetime--.--------------------------------------------+     
                     +-rowid--.-----------------------------------------------+     
                     '-binary--.----------------------------------------------'     

floating-point

|--+----------------------------------------+------------------->
   |          .-IS-.                        |   
   | .-USAGE--+----+-.                      |   
   '-+---------------+--+-COMPUTATIONAL-1-+-'   
                        +-COMP-1----------+     
                        +-COMPUTATIONAL-2-+     
                        '-COMP-2----------'     

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

usage-clause

|--+--------------------------------------------+--------------->
   |          .-IS-.                            |   
   | .-USAGE--+----+-.                          |   
   '-+---------------+--+-+-BINARY----------+-+-'   
                        | +-COMPUTATIONAL-4-+ |     
                        | '-COMP-4----------' |     
                        +-+-PACKED-DECIMAL--+-+     
                        | +-COMPUTATIONAL-3-+ |     
                        | +-COMP-3----------+ |     
                        | +-COMPUTATIONAL---+ |     
                        | '-COMP------------' |     
                        +-+-DISPLAY--------+--+     
                        | '-display-clause-'  |     
                        '---DISPLAY-1---------'     

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

display-clause

   .-DISPLAY-.        .-IS-.                     .-CHARACTER-.   
|--+---------+--SIGN--+----+--LEADING--SEPARATE--+-----------+--|

Read syntax diagramSkip visual syntax diagram
varchar-string

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

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

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

                           .-IS-.                                                     
>--49--var-3--+-PICTURE-+--+----+--picture-string-3--+----------------------------+-->
              '-PIC-----'                            |          .-IS-.            |   
                                                     | .-USAGE--+----+-.          |   
                                                     '-+---------------+--DISPLAY-'   

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

vargraphic-string

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

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

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

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

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

Read syntax diagramSkip visual syntax diagram
lob

            .-IS-.                                                           
   .-USAGE--+----+-.                                                         
|--+---------------+--SQL TYPE IS--+-+-CLOB---+--(--lob-length--+---+--)-+--|
                                   | +-DBCLOB-+                 +-K-+    |   
                                   | '-BLOB---'                 '-M-'    |   
                                   +-+-CLOB-LOCATOR---+------------------+   
                                   | +-DBCLOB-LOCATOR-+                  |   
                                   | '-BLOB-LOCATOR---'                  |   
                                   '-+-CLOB-FILE---+---------------------'   
                                     +-DBCLOB-FILE-+                         
                                     '-BLOB-FILE---'                         

datetime

                          .-OF-.                 .-IS-.   
|--variable-name--FORMAT--+----+--+-DATE------+--+----+--------->
                                  +-TIME------+           
                                  '-TIMESTAMP-'           

>--format-options-----------------------------------------------|

rowid

|--SQL TYPE IS ROWID--------------------------------------------|

binary

            .-IS-.                                                        
   .-USAGE--+----+-.                                                      
|--+---------------+--SQL TYPE IS----+-BINARY---------+--(--length--)----|
                                     +-VARBINARY------+                   
                                     '-BINARY VARYING-'                   

Notes:
  1. level-1 indicates a COBOL level between 2 and 47.
  2. level-2 indicates a COBOL level between 3 and 48 where level-2 > level-1.
  3. Graphic host variables, LOB host variables, and floating-point host variables are only supported for ILE COBOL for iSeries™.
  4. For details on declaring numeric, character, graphic, LOB, ROWID, and binary host variables, see the notes under numeric-host variables, character-host variables, graphic-host variables, LOB, ROWID, and binary host variables.
  5. Dimension must be an integer constant between 1 and 32767.
  6. format-options indicates valid datetime options that are supported by the COBOL compiler. See the ILE COBOL Reference manual on the V5R1 Supplemental ManualsLink outside information center Web site for details.