************************************************************************* 
      ** 
      ** Source File Name = dbstart.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 IBM Corp. 
      ** 
      ** 
      ** PURPOSE: to dbstart a database when it has been abnormally terminated 
      ** 
      ** APIs USED : 
      **        START DATABASE MANAGER  sqlgpstart() 
      ** 
      ** 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. "dbstart".

       Data Division.
       Working-Storage Section.

           copy "sqlenv.cbl".
           copy "sqlca.cbl".

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

       Procedure Division.
       Main Section.
           display "Sample COBOL program: dbstart.cbl".

      ************************** 
      * START DATABASE MANAGER * 
      ************************** 

           call "sqlgpstart" using
                                  by value 0         
                                  by reference sqlca
                             returning rc.
           if rc equal SQLE-RC-INVSTRT
              display "The database manager is already active"
              go to End-Main.

           move "START DATABASE MANAGER" to errloc.
           call "checkerr" using SQLCA errloc.

           display "The database has been successfully STARTED".
       End-Main.
           stop run.