#! /bin/ksh # (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. # embprep script file # Shell script to prep and bind C/C++ and # Micro Focus COBOL embedded SQL programs. # Usage: embprep <prog_name> [ <db_name> [ <userid> <password> ]] # Connect to a database. if (($# < 2)) then db2 connect to sample elif (($# < 3)) then db2 connect to $2 else db2 connect to $2 user $3 using $4 fi # Precompile the program. if [[ -f $1".sqc" ]] then db2 prep $1.sqc bindfile if [[ -f utilemb.sqc ]] then db2 prep utilemb.sqc fi elif [[ -f $1".sqC" ]] then db2 prep $1.sqC bindfile if [[ -f utilemb.sqC ]] then db2 prep utilemb.sqC fi elif [[ -f $1".sqb" ]] then db2 prep $1.sqb bindfile target mfcob fi # Bind the program to the database. db2 bind $1.bnd # Disconnect from the database. db2 connect reset db2 terminate