home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
VSCPPv8.zip
/
VACPP
/
IBMCPP
/
samples
/
DATABASE
/
CAR
/
DAXSAMP
/
DAXSAMP.CMD
< prev
next >
Wrap
OS/2 REXX Batch file
|
1995-06-06
|
4KB
|
87 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.
*/
/* 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 DAXSAMP"
say "Enter the target drive letter: "
pull drive
if ( DATATYPE(drive,M) = 1 & LENGTH(drive) = 1 ) then do
say "WARNING: The database DAXSAMP will be deleted if it exists,"
say "and all data in that database will be lost. DAXSAMP will be"
say "(re)created on drive" drive", okay(y|n)?"
pull okay
if okay = "Y" then do
startdbm
say "Dropping DAXSAMP... Any failure of this step may be ignored."
call dbm "drop database daxsamp"
say "Any failures after this point must be investigated - consult the DB2/2 Messages Guide, resolve and retry."
say "Creating DAXSAMP..."
call dbm "create database daxsamp on" drive
call dbm "connect to daxsamp"
call dbm "create table car(Make varchar(20), Model varchar(20), License char(10) not null, primary key(License))"
call dbm "alter table car add Category varchar(20)"
call dbm "alter table car add Colour varchar(20)"
say "Populating DAXSAMP..."
call dbm "insert into car values( 'MG', 'A', '123-WWW', 'Sport', 'Green' )"
call dbm "insert into car values( 'MG', 'B', '123-BBB', 'Sport', 'Green' )"
call dbm "insert into car values( 'MG', 'C', '123-ABC', 'Sport', 'Green' )"
call dbm "insert into car values( 'MG', 'BGT', '123-DEF', 'Sport', 'Red' )"
call dbm "insert into car values( 'MG', 'V8', '123-XYZ', 'Sport', 'Red' )"
call dbm "insert into car values( 'MG', 'RV8', '123-ZYX', 'Sport', 'Red' )"
call dbm "insert into car values( 'Honda', 'Civic', 'ABC-456', 'Passenger', 'White' )"
call dbm "insert into car values( 'Honda', 'Prelude', 'DEF-456', 'Passenger', 'Blue' )"
call dbm "insert into car values( 'Honda', 'Accord', 'GHI-456', 'Passenger', 'White' )"
call dbm "insert into car values( 'Honda', 'CRX', 'JKL-456', 'Sport', 'Red' )"
call dbm "insert into car values( 'Honda', 'del Sol', 'MNO-456', 'Sport', 'Red' )"
call dbm "commit"
say "Binding carv.bnd to the database DAXSAMP..."
call dbm "bind carv.bnd to database DAXSAMP"
say "Binding daxscl.bnd to the database DAXSAMP..."
call dbm "bind" BasePath"\bnd\daxscl.bnd to database DAXSAMP"
call dbm "commit"
call dbm "connect reset"
say "DAXSAMP Creation complete."
say "Copying carv.dll to" BasePath"\dll..."
copy "carv.dll" BasePath"\dll"
say "Copy complete."
end
else
say "DAXSAMP creation cancelled."
end
else do
say "Invalid drive letter " drive
say "DAXSAMP was not created."
end
call Finished
Aborted:
say "Error creating database." rc
say "Consult the DB2/2 Messages Guide for more information."
call Finished
Finished:
say "Press enter to exit."
pull done
exit