************************************************************************* ** ** Source File Name = restart.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 restart a database when it has been abnormally terminated ** ** APIs USED : ** RESTART DATABASE sqlgrstd() ** ** 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. "restart". Data Division. Working-Storage Section. copy "sqlenv.cbl". copy "sql.cbl". copy "sqlca.cbl". * Local variables 77 rc pic s9(9) comp-5. 77 errloc pic x(80). * Variables used for the RESTART DATABASE API 77 dbname-len pic s9(4) comp-5 value 0. 77 passwd-len pic s9(4) comp-5 value 0. 77 userid-len pic s9(4) comp-5 value 0. 77 dbname pic x(9). 77 passwd pic x(19). 77 userid pic x(9). Procedure Division. Main Section. display "Sample COBOL program: restart.cbl". display "Enter in the database name to restart :" with no advancing. accept dbname. display "Enter in your user id :" with no advancing. accept userid. display "Enter in your password :" with no advancing. accept passwd. inspect dbname tallying dbname-len for characters before initial " ". inspect userid tallying userid-len for characters before initial " ". inspect passwd tallying passwd-len for characters before initial " ". **************************** * RESTART DATABASE MANAGER * **************************** call "sqlgrstd" using by value passwd-len by value userid-len by value dbname-len by reference sqlca by reference passwd by reference userid by reference dbname returning rc. move "RESTART DATABASE" to errloc. call "checkerr" using SQLCA errloc. display "The database has been successfully RESTARTED". End-Main. stop run.