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 >
OS/2 REXX Batch file  |  1995-06-06  |  4KB  |  87 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. /* Get the path of the VisualAge C++ installation */
  16. env='OS2ENVIRONMENT';
  17. BasePath = VALUE('CPPMAIN',,env);
  18. if BasePath="" then do
  19.    say "Error: CPPMAIN environment variable not set."
  20.    call Finished
  21. end
  22.  
  23. say "Creating the database DAXSAMP"
  24. say "Enter the target drive letter: "
  25. pull drive
  26. if ( DATATYPE(drive,M) = 1 & LENGTH(drive) = 1 ) then do
  27.   say "WARNING: The database DAXSAMP will be deleted if it exists,"
  28.   say "and all data in that database will be lost.  DAXSAMP will be"
  29.   say "(re)created  on drive" drive", okay(y|n)?"
  30.   pull okay
  31.   if okay = "Y" then do
  32.  
  33.     startdbm
  34.     say "Dropping DAXSAMP... Any failure of this step may be ignored."
  35.     call dbm "drop database daxsamp"
  36.     say "Any failures after this point must be investigated - consult the DB2/2 Messages Guide, resolve and retry."
  37.     say "Creating DAXSAMP..."
  38.     call dbm "create database daxsamp on" drive
  39.     call dbm "connect to daxsamp"
  40.     call dbm "create table car(Make varchar(20), Model varchar(20), License char(10) not null, primary key(License))"
  41.     call dbm "alter table car add Category varchar(20)"
  42.     call dbm "alter table car add Colour varchar(20)"
  43.     say "Populating DAXSAMP..."
  44.     call dbm "insert into car values( 'MG', 'A', '123-WWW', 'Sport', 'Green' )"
  45.     call dbm "insert into car values( 'MG', 'B', '123-BBB', 'Sport', 'Green' )"
  46.     call dbm "insert into car values( 'MG', 'C', '123-ABC', 'Sport', 'Green' )"
  47.     call dbm "insert into car values( 'MG', 'BGT', '123-DEF', 'Sport', 'Red' )"
  48.     call dbm "insert into car values( 'MG', 'V8', '123-XYZ', 'Sport', 'Red' )"
  49.     call dbm "insert into car values( 'MG', 'RV8', '123-ZYX', 'Sport', 'Red' )"
  50.     call dbm "insert into car values( 'Honda', 'Civic', 'ABC-456', 'Passenger', 'White' )"
  51.     call dbm "insert into car values( 'Honda', 'Prelude', 'DEF-456', 'Passenger', 'Blue' )"
  52.     call dbm "insert into car values( 'Honda', 'Accord', 'GHI-456', 'Passenger', 'White' )"
  53.     call dbm "insert into car values( 'Honda', 'CRX', 'JKL-456', 'Sport', 'Red' )"
  54.     call dbm "insert into car values( 'Honda', 'del Sol', 'MNO-456', 'Sport', 'Red' )"
  55.     call dbm "commit"
  56.     say "Binding carv.bnd to the database DAXSAMP..."
  57.     call dbm "bind carv.bnd to database DAXSAMP"
  58.     say "Binding daxscl.bnd to the database DAXSAMP..."
  59.     call dbm "bind" BasePath"\bnd\daxscl.bnd to database DAXSAMP"
  60.     call dbm "commit"
  61.     call dbm "connect reset"
  62.     say "DAXSAMP Creation complete."
  63.     say "Copying carv.dll to" BasePath"\dll..."
  64.     copy "carv.dll" BasePath"\dll"
  65.     say "Copy complete."
  66.  
  67.   end
  68.   else
  69.     say "DAXSAMP creation cancelled."
  70. end
  71. else do
  72.   say "Invalid drive letter " drive
  73.   say "DAXSAMP was not created."
  74. end
  75. call Finished
  76.  
  77. Aborted:
  78.   say "Error creating database." rc
  79.   say "Consult the DB2/2 Messages Guide for more information."
  80.   call Finished
  81.  
  82.  
  83. Finished:
  84. say "Press enter to exit."
  85. pull done
  86. exit
  87.