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   
OS/2 REXX Batch file  |  1995-06-06  |  3KB  |  64 lines

  1. /* REXX */
  2. /*
  3.  COPYRIGHT: Copyright (C) International Business Machines Corp., 1992,1994.
  4.  
  5.  DISCLAIMER OF WARRANTIES:
  6.    The following [enclosed] code is sample code created by IBM
  7.    Corporation.  This sample code is not part of any standard IBM product
  8.    and is provided to you solely for the purpose of assisting you in the
  9.    development of your applications.  The code is provided "AS IS",
  10.    without warranty of any kind.  IBM shall not be liable for any damages
  11.    arising out of your use of the sample code, even if they have been
  12.    advised of the possibility of such damages.
  13. */
  14.  
  15. DBName = "BrchTwo"
  16.  
  17. /* Get the path of the VisualAge C++ installation */
  18. env='OS2ENVIRONMENT';
  19. BasePath = VALUE('CPPMAIN',,env);
  20. if BasePath="" then do
  21.    say "Error: CPPMAIN environment variable not set."
  22.    call Finished
  23. end
  24.  
  25. say "Creating the database" DBName
  26. say "Enter the target drive letter: "
  27. pull drive
  28. if ( DATATYPE(drive,M) = 1 & LENGTH(drive) = 1 ) then do
  29.     say "Creating" DBName "on drive " drive
  30.     call dbm "create database "DBName" on" drive
  31.     call dbm "connect to" DBName
  32.     call dbm "create table inventory (prodNumber char(10) not null, primary key (prodNumber))"
  33.     call dbm "alter table inventory add listingPrice float not null with default"
  34.     call dbm "alter table inventory add averageCost float not null with default"
  35.     call dbm "alter table inventory add onHandQuantity int not null with default"
  36.     call dbm "alter table inventory add prodDescription char(20) not null with default"
  37.     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)"
  38.     call dbm "alter table receivedOrder add receivedQuantity int not null with default"
  39.     call dbm "alter table receivedOrder add totalCost float not null with default"
  40.     call dbm "alter table receivedOrder add receivedDate date not null with default"
  41.     call dbm "alter table receivedOrder add postedFlag int not null with default"
  42.     call dbm "commit"
  43.     say "Binding INVENTOI.BND to the database" DBName
  44.     call dbm "bind inventoi.bnd to database" DBName
  45.     say "Binding PRCLISTI.BND to the database" DBName
  46.     call dbm "bind prclisti.bnd to database" DBName
  47.     say "Binding RECEIVEI.BND to the database" DBName
  48.     call dbm "bind receivei.bnd to database" DBName
  49.     say "Binding daxscl.bnd to the database" DBName
  50.     call dbm "bind" BasePath"\bnd\daxscl.bnd to database" DBName
  51.     call dbm "commit"
  52.     call dbm "connect reset"
  53.     call resetdb
  54. end
  55. else do
  56.   say "Invalid drive letter " drive
  57.   say DBName "was not created."
  58. end
  59.  
  60. FINISHED:
  61. say "Press enter to exit."
  62. pull done
  63. exit
  64.