home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
VSCPPv8.zip
/
VACPP
/
IBMCPP
/
samples
/
DATABASE
/
STOCK
/
SOM
/
SETUPDB.CMD
< prev
Wrap
OS/2 REXX Batch file
|
1995-06-06
|
3KB
|
64 lines
/* REXX */
/*
COPYRIGHT: Copyright (C) International Business Machines Corp., 1992,1994.
DISCLAIMER OF WARRANTIES:
The following [enclosed] code is sample code created by IBM
Corporation. This sample code is not part of any standard IBM product
and is provided to you solely for the purpose of assisting you in the
development of your applications. The code is provided "AS IS",
without warranty of any kind. IBM shall not be liable for any damages
arising out of your use of the sample code, even if they have been
advised of the possibility of such damages.
*/
DBName = "BrchTwo"
/* Get the path of the VisualAge C++ installation */
env='OS2ENVIRONMENT';
BasePath = VALUE('CPPMAIN',,env);
if BasePath="" then do
say "Error: CPPMAIN environment variable not set."
call Finished
end
say "Creating the database" DBName
say "Enter the target drive letter: "
pull drive
if ( DATATYPE(drive,M) = 1 & LENGTH(drive) = 1 ) then do
say "Creating" DBName "on drive " drive
call dbm "create database "DBName" on" drive
call dbm "connect to" DBName
call dbm "create table inventory (prodNumber char(10) not null, primary key (prodNumber))"
call dbm "alter table inventory add listingPrice float not null with default"
call dbm "alter table inventory add averageCost float not null with default"
call dbm "alter table inventory add onHandQuantity int not null with default"
call dbm "alter table inventory add prodDescription char(20) not null with default"
call dbm "create table receivedOrder (receivedNumber smallint not null, prodNumber char(10) not null with default, primary key(receivedNumber), foreign key fk1(prodNumber) references inventory)"
call dbm "alter table receivedOrder add receivedQuantity int not null with default"
call dbm "alter table receivedOrder add totalCost float not null with default"
call dbm "alter table receivedOrder add receivedDate date not null with default"
call dbm "alter table receivedOrder add postedFlag int not null with default"
call dbm "commit"
say "Binding INVENTOI.BND to the database" DBName
call dbm "bind inventoi.bnd to database" DBName
say "Binding PRCLISTI.BND to the database" DBName
call dbm "bind prclisti.bnd to database" DBName
say "Binding RECEIVEI.BND to the database" DBName
call dbm "bind receivei.bnd to database" DBName
say "Binding daxscl.bnd to the database" DBName
call dbm "bind" BasePath"\bnd\daxscl.bnd to database" DBName
call dbm "commit"
call dbm "connect reset"
call resetdb
end
else do
say "Invalid drive letter " drive
say DBName "was not created."
end
FINISHED:
say "Press enter to exit."
pull done
exit