************************************************************************* 
      ** 
      ** Source File Name = d_dbmcon.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. 
      ** 
      **    APIs USED : 
      **       GET DATABASE MANAGER CONFIGURATION DEFAULTS    sqlgdsys() 
      **       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_dbmcon".

       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 dbname              pic x(8) value "sample".
       01 dbname-len          pic s9(4) comp-5 value 6.

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

      * variables for GET DATABASE MANAGER CONFIGURATION DEFAULTS 
       01 listnumber          pic s9(4) comp-5 value 2.
      

       Procedure Division.
       dbmcon-pgm section.

           display "Sample COBOL Program : d_dbmcon.cbl".

           move SQLF-KTN-MAXAGENTS  to token(1).
           move SQLF-KTN-NUMDB to token(2).

           move "GET ADDRESS" to errloc.
      
      ************************** 
      * GET ADDRESS API called * 
      ************************** 
           call "sqlgaddr" using by reference max-agents
                                 by reference tokenptr(1)
                           returning rc.
      
           call "sqlgaddr" using by reference numbdb
                                 by reference tokenptr(2)
                           returning rc.
      
      ************************************************** 
      * GET DATABASE CONFIGURATION DEFAULTS API called * 
      ************************************************** 
           call "sqlgdsys" using by value     listnumber
                                 by reference tokenlist
                                 by reference sqlca
                           returning rc.
      

           move "GET DB CFG DEFAULTS" to errloc.
           call "checkerr" using SQLCA errloc.

           display "Max. number of Agents                  : ",
                    max-agents.
           display "Number of concurrent active DB allowed : ",
                    numbdb.

       end-dbmcon. stop run.