************************************************************************* 
      ** 
      ** Source File Name = d_dbconf.cbl  
      ** 
      ** Licensed Materials - Property of IBM 
      ** 
      ** (C) COPYRIGHT International Business Machines Corp. 1995, 2000 
      ** All Rights Reserved. 
      ** 
      ** US Government Users Restricted Rights - Use, duplication or 
      ** disclosure restricted by GSA ADP Schedule Contract with 
      ** 
      **    PURPOSE : 
      **       This program is an example of how APIs are implemented in order 
      **       to obtain Database Configuration Defaults, by using the 
      **       GET DATABASE CONFIGURATION DEFAULTS API. 
      ** 
      ** 
      **    APIs USED : 
      **       GET DATABASE CONFIGURATION DEFAULTS    sqlgddb() 
      **       GET ADDRESS                            sqlgaddr() 
      ** 
      ** 
      ** For more information about these samples see the README file. 
      ** 
      ** For more information on Programming in COBOL, see the: 
      **    -  "Programming in COBOL" section of the Application Development Guide. 
      ** 
      ** For more information on Building COBOL Applications, see the: 
      **    - "Building COBOL Applications" section of the Application Building Guide. 
      ** 
      ** For more information on the SQL language see the SQL Reference. 
      ** 
      ************************************************************************* 

       Identification Division.
       Program-Id. "d_dbconf".

       Data Division.
       Working-Storage Section.
       copy "sqlutil.cbl".
       copy "sqlca.cbl".

      * Local Variables 
       77 rc                  pic s9(9) comp-5.
       
       77 errloc              pic x(80).

       01 buff-page           pic 9(9) comp-5.
       01 maxfilop            pic s9(4) comp-5.
       01 softmax             pic s9(4) comp-5.
       01 logpath             pic x(256).

       
      * variables for GET ADDRESS 
       01 locklist            pic s9(4) comp-5.
       01 tokenlist.
          05 tokens occurs 5 times.
             10 token         pic 9(4) comp-5.
             10 filler        pic x(2).
             10 tokenptr      usage is pointer.

      * variables for GET DATABASE CONFIGURATION DEFAULTS 
       01 dbname              pic x(8) value "sample".
       01 dbname-len          pic s9(4) comp-5 value 6.
       01 listnumber          pic s9(4) comp-5 value 5.
       

       Procedure Division.
       dbconf-pgm section.

           display "Sample COBOL Program : d_dbconf.cbl".

           move SQLF-DBTN-LOCKLIST  to token(1).
           move SQLF-DBTN-BUFF-PAGE to token(2).
           move SQLF-DBTN-MAXFILOP  to token(3).
           move SQLF-DBTN-SOFTMAX   to token(4).
           move SQLF-DBTN-LOGPATH   to token(5).

           move "GET ADDRESS" to errloc.
       
      ************************** 
      * GET ADDRESS API called * 
      ************************** 
           call "sqlgaddr" using by reference locklist
                                 by reference tokenptr(1)
                           returning rc.

           call "sqlgaddr" using by reference buff-page
                                 by reference tokenptr(2)
                           returning rc.

           call "sqlgaddr" using by reference maxfilop
                                 by reference tokenptr(3)
                           returning rc.

           call "sqlgaddr" using by reference softmax
                                 by reference tokenptr(4)
                           returning rc.

           call "sqlgaddr" using by reference logpath
                                 by reference tokenptr(5)
                           returning rc.
       
      ************************************************** 
      * GET DATABASE CONFIGURATION DEFAULTS API called * 
      ************************************************** 
           call "sqlgddb" using by value     dbname-len
                                by value     listnumber
                                by reference tokenlist
                                by reference sqlca
                                by reference dbname
                           returning rc.
       
           move "GET DB CFG DEFAULTS" to errloc.
           call "checkerr" using SQLCA errloc.

           display "Max. storage for lost lists (4kb)           : ",
                    locklist.
           display "Buffer pool size (4kb)                      : ",
                    buff-page.
           display "Max. DB files open per application          : ",
                    maxfilop.
           display "percent log reclaimed before soft checkpoint: ",
                    softmax.
           display "path [not changeable]                       : ",
                    logpath.

       end-dbconf. stop run.