$ ! Copyright © 1995, 2005, Oracle Corporation. All Rights Reserved. $ save_verify = 'F$VERIFY(0)' $!---------------------------------------------------------------------- $! File: RDM$DEMO:PERSONNEL.COM $! $! This command procedure builds a copy of a sample database in a $! in a user-specified directory. $! $! The procedure builds a single-file database, PERSONNEL, a multifile $! database, MF_PERSONNEL, or a single-file multischema database, $! CORPORATE_DATA. $! $! When the procedure builds PERSONNEL or MF_PERSONNEL, it uses SQL $! definitions. If the user requests that the definitions also be placed $! in the data dictionary (CDD/Repository), then the $! database is integrated after the definition and database loading. $! $! If a CDD object or a database file in the specified directory has the $! same name as the database being created, then this procedure terminates $! with an error. $! $! When the procedure builds the multischema database, CORPORATE_DATA, it $! uses SQL. This database cannot be integrated with the data $! dictionary. $! $! $! This procedure accepts five parameters: $! $! P1 Indicates the language interface to use. Either RDO or SQL. $! If empty, then SQL will be used. $! $! P2 Indicates the type of database to create, single file ("S") $! or multi-file ("M"). If empty, then "S" will be used. $! $! P3 Indicates if the data dictionary, CDD/Repository, $! should be used when creating the database. $! Either CDD or NOCDD is accepted. If empty, the $! the user is asked whether or not the dictionary $! is to be used. $! $! P4 Indicates if a SQL multischema database will be created. $! "MSDB" must be used; if blank, this feature is ignored. $! If creating a multischema database, P1 must be "SQL", P2 must $! be "S", (a multifile, multischema example may be given in the $! future), and P3 must be "NOCDD". $! $! P5 Indicates the directory where the database is created. If $! empty, the user is asked where to create the database. If $! running in batch and this parameter is empty, the default $! directory will be used. $! $! Notes: SQLINI or RDOINI are defined to NL: to prevent initialization files $! defined by the user from altering the effects of the definitions. $! $! This command procedure requires the following command files: $! $! RDM$DEMO:EMPLOYEES.DAT $! RDM$DEMO:PAYROLL.UNL $! RDM$DEMO:DEPTS.DAT $! REM$DEMO:JOBS.DAT $! RDM$DEMO:JOBHIST.DAT $! RDM$DEMO:SALHIST.DAT $! RDM$DEMO:COLLEGES.DAT $! RDM$DEMO:DEGREES.DAT $! $! RDM$DEMO:BUILDPERS.SQL $! RDM$DEMO:SQL_CREATE_STORAGE.SQL $! RDM$DEMO:MF_BUILDPERS.SQL $! RDM$DEMO:INDEXES.SQL $! RDM$DEMO:TRIGGERS.SQL $! RDM$DEMO:MF_INDEXES.SQL $! RDM$DEMO:LIST.SQL $! $! RDM$DEMO:MSDB_CREATE_DATABASE.SQL $! RDM$DEMO:MSDB_DATA_LOAD.COM $! RDM$DEMO:MSDB_INDEXES.SQL $! $! RDM$DEMO:EMPLOYEES.UNL $! RDM$DEMO:PAYROLL.UNL $! RDM$DEMO:DEPARTMENTS.UNL $! RDM$DEMO:JOB_HISTORY.UNL $! RDM$DEMO:CANDIDATES.UNL $! RDM$DEMO:SALARY_HISTORY.UNL $! RDM$DEMO:COLLEGES.UNL $! RDM$DEMO:RESUMES.UNL $! RDM$DEMO:DEGREES.UNL $! RDM$DEMO:WORK_STATUS.UNL $! RDM$DEMO:DEPARTMENTS1.UNL $! $! $! Modification History $! Version Date Authors Comments $!---------------------------------------------------------------------- $! V7.0 13-APR-2005 IES don't deassign PERSONNEL/SQL_PERSONNEL unless $! defined by this procedure. $! V6.0 07-DEC-93 JLD Removed redundant ATTACH before MSDB_INDEXES runs $! V6.0 29-SEP-93 JLD Changed refs to CDD/Plus to CDD/Repository $! V6.0 28-AUG-93 JLD Fixed error causing MSDB database to build $! in default dir even when user specified another dir $! V6.0 20-AUG-93 JLD Fixed error causing MSDB database build to $! check for PERSONNEL instead of CORPORATE_DATA $! V5.0 11-NOV-92 BF set up to run in batch. $! JLD updated references to CDD and VAX for V5.0 $! V5.0 08-OCT-92 JLD Set prefix to SQL for both RDO and SQL $! builds because certain RDO compilers aren't there. $! V4.2 10-JUN-92 JLD Added Multischema files required to comments $! V4.1 20-JUL-91 KLB Added SQL Multischema database example. $! V4.0 25-JAN-90 Added RESUMES table using segmented strings. Also $! added LIST.SQL which loads 3 rows into RESUMES. DF $! V3.1 11-APR-89 IES/CJM Re-wrote for Rdb/VMS V3.1 $! -1 13-OCT-89 IES Date/times are in English and in the VMS $! standard format. Force environment to match $! and avoid failures on some systems due to language $! and format differences. $!---------------------------------------------------------------------- $ w = "write sys$output" $ abort = "exit %X2C" ! SS$_ABORT $ error_banner = F$FAO("!/** Error Detected **!/") $ on control_y then goto EXIT_BUILD $ set on $ $ CHECK_PARAMS: $! $! Parameters (all optional): $! P1 = interface language SQL or RDO $! P2 = type of database S (single-file) or M (multifile) $! P3 = dictionary use CDD (yes) or NOCDD (no) $! P4 = multischema db MSDB $! P4 = directory spec DISK:[dir] or logical: $! $ $! $! Convert input parameters to uppercase, and apply defaults $! $ p1 = F$EDIT(p1, "UPCASE,COLLAPSE") $ if (p1 .eqs. "") $ then $ ! $ ! Default to SQL language definition $ ! $ p1 = "SQL" $ else $ if (p1 .nes. "SQL") .and. (p1 .nes. "RDO") then goto BAD_P1 $ endif $ $ p2 = F$EDIT(p2, "UPCASE,COLLAPSE") $ if (p2 .eqs. "") $ then $ ! $ ! Default to Single file database $ ! $ p2 = "S" $ else $ if (p2 .nes. "S") .and. (p2 .nes. "M") then goto BAD_P2 $ endif $ $! $! P3 must be omitted, or must specify either CDD or NOCDD $! $ p3 = F$EDIT(p3, "UPCASE,COLLAPSE") $ if (p3 .nes. "") .and. - (p3 .nes. "CDD") .and. - (p3 .nes. "NOCDD") then goto BAD_P3 $! $! P4 must be omitted, or must specify MSDB. If MSDB specified, then check $! that all other parameters meet current restrictions. $! $ p4 = F$EDIT(p4, "UPCASE,COLLAPSE") $ if (p4 .nes. "") .and. (p4 .nes. "MSDB") then goto BAD_P4 $! $ if (p4 .eqs. "MSDB") .and. (p1 .eqs. "RDO") then goto BAD_MSDB $ if (p4 .eqs. "MSDB") .and. (p2 .eqs. "M") then goto BAD_MSDB $ if (p4 .eqs. "MSDB") .and. (p3 .eqs. "CDD") then goto BAD_MSDB $! $ INIT_CONSTANTS: $! $! Initialize constants for build procedure $! $ TRUE = 1 $ FALSE = 0 $ demo_define_used = FALSE $ demo$sql == "$SQL$" $ demo$rdo == "$RDO" $ $ ! $ ! Need to avoid user defined symbols that look like DCL commands $ ! $ append = "APPEND" $ define = "DEFINE" $ delete = "DELETE" $ exit = "EXIT" $ return = "RETURN" $ run = "RUN/NODEBUG" $ $ ! $ ! If an initialization file exists then use it... $ ! Note: Used for development of this procedure and not required $ ! at customer sites. For example it can be used to enable VERIFY $ ! during testing. $ ! $ if F$TRNLNM("RDM$DEMO_INIT") .nes. "" then @RDM$DEMO_INIT $ ! $ ! Startup check. This procedure needs RDM$DEMO defined before it can do $ ! anything useful. $ ! $ if F$TRNLNM("RDM$DEMO") .eqs. "" then goto BAD_DEMO $ $! $! Use meaningful names for input parameters $! $ utility = p1 $ db_type = p2 $ cdd_flag = p3 $ multischema = p4 $ dir_spec = p5 $ use_msdb = FALSE $ $! $! Set disk space requirements for database build. The differences are most $! likely due to different metadata, and descriptions text used in the $! different definitions. $! $ if (utility .eqs. "SQL") $ then $ if (db_type .eqs. "S") $ then $ if (multischema .eqs. "MSDB") $ then $ disk_req = 3400 ! SQL Multischema db $ else $ disk_req = 3200 ! SQL single file $ endif $ else $ disk_req = 4000 ! SQL multi file $ endif $ else $ if (db_type .eqs. "S") $ then $ disk_req = 2400 ! RDO single file $ else $ disk_req = 3800 ! RDO multi file $ endif $ endif $ $! $! Define utility specific symbols $! $ if utility .eqs. "SQL" $ then $ prefix = "SQL_LOAD_" $ else $ prefix = "SQL_LOAD_" $ endif $ $! $! Select type of database $! $ if db_type .eqs. "S" $ then $ db_name = "PERSONNEL" $ else $ db_name = "MF_PERSONNEL" $ endif $! $ if (multischema .eqs. "MSDB") then db_name = "CORPORATE_DATA" $! $! Use the current directory as the database location $! $ define/nolog DEMO$DIR "''F$ENVIRONMENT("DEFAULT")'" $ $! $! Default location is in the user's current directory $! $ define/nolog DEMO$DB_NAME "''F$TRNLNM("DEMO$DIR")'''DB_NAME'" $ $! $! Save current CDD$DEFAULT $! $ if F$TRNLNM("CDD$DEFAULT") .eqs. "" $ then $ define/nolog DEMO$PATH "CDD$TOP" $ else $ define/nolog DEMO$PATH "''F$TRNLNM("CDD$DEFAULT")'" $ endif $ $! $! Display a message informing the user of the function of this procedure $! $ w "" $ w "This command file builds the Oracle Rdb sample database, ",DB_NAME,"." $ w "It requires approximately ",DISK_REQ," blocks of disk space." $ w "" $ w "You may enter the name of a VMS directory in which to create the database" $ w "or use your current default directory." $ w "" $ w "If you are building the PERSONNEL or MF_PERSONNEL database and CDD/Repository" $ w "is installed on your system, you can have the database definitions placed" $ w "in the data dictionary. In this case, you must specify a data dictionary" $ w "directory in which to create the definitions." $ w "" $ w "NOTE: If a copy of ",DB_NAME," already exists in the location you specify," $ w "this command procedure will stop." $ $ $! Has the CDD been selected from the command line? $! $ if (cdd_flag .eqs. "") $ then $ if f$mode() .eqs. "BATCH" $ then $ cdd_flag = "NOCDD" $ option = "" $ else $ ! $ ! Ask the user about CDD/Repository $ ! $ ASK_CDD: $ w "" $ read sys$command/END=EXIT_BUILD option - /prompt="Do you wish to use CDD/Repository? (Yes, No, Exit) [default=No] " $ option = F$EXTRACT(0,1,F$EDIT(option, "UPCASE,COLLAPSE")) $ if F$LENGTH(option) .eq. 0 then option = "N" $ if (option .eqs. "E") $ then $ goto EXIT_BUILD $ endif $ if (option .nes. "N") .and. (option .nes. "Y") $ then $ w "Please answer Y for YES, or N for NO, or E to exit procedure" $ goto ASK_CDD $ endif $ endif $ else $ option = "" $ endif $ $ CHECK_SELECTION: $! $! Check the users selection $! $ if (option .eqs. "Y") .or. (cdd_flag .eqs. "CDD") $ then $ use_dictionary = TRUE $ else $ use_dictionary = FALSE $ endif $! $ if (use_dictionary) $ then if (multischema .eqs. "MSDB") $ then $ goto BAD_CDD_MSDB $ else $ goto USE_CDD $ endif $ endif $! $ $! Has a multischema database been selected from the command line? If not, $! see if the user wants one. (*requested by doc). $! $ if f$mode() .eqs. "BATCH" $ then $ option = "" $ else $ if (utility .eqs. "SQL") .and. - (db_type .eqs. "S") .and. - (.not. use_dictionary) .and. - (multischema .eqs. "") $ then $ ! $ ! ask if they *want* a Multischema database $ ! $ ASK_MSDB: $ w "" $ read sys$command/END=EXIT_BUILD option - /prompt="Do you wish to create a multischema database? (Yes, No, Exit) [default=No] " $ option = F$EXTRACT(0,1,F$EDIT(option, "UPCASE,COLLAPSE")) $ if F$LENGTH(option) .eq. 0 then option = "N" $ if (option .eqs. "E") $ then $ goto EXIT_BUILD $ endif $ if (option .nes. "N") .and. (option .nes. "Y") $ then $ w "Please answer Y for YES, or N for NO, or E to exit procedure" $ goto ASK_MSDB $ endif $ else $ option = "" $ endif $ endif $ $! Check the users selection $! $ if (option .eqs. "Y") .or. (multischema .eqs. "MSDB") $ then $ $ if (use_dictionary) $ then $ goto BAD_CDD_MSDB $ else $ use_msdb = TRUE $ db_name = "CORPORATE_DATA" $ define/nolog DEMO$DB_NAME "''F$TRNLNM("DEMO$DIR")'''DB_NAME'" $ goto NO_CDD $ endif $ else ! not using multischema $ use_msdb = FALSE $ if (use_dictionary) $ then $ goto USE_CDD: $ else $ goto NO_CDD $ endif $ endif $! $! $ USE_CDD: $! $! Get the pathname $! $ w "" $ w " >> Checking for CDD/Repository on this system" $ w "" $ $ on error then goto CDD_ERROR_1 $ define/nolog/user SYS$OUTPUT NL: $ dictionary operator show version $ $ w " Enter the complete pathname for a directory in the Dictionary" $ w " where you wish to store the database definitions." $ w "" $ $ if f$mode() .nes. "BATCH" $ then $ read sys$command/END=EXIT_BUILD home_node - /prompt="CDD pathname; default is ''F$TRNLNM("DEMO$PATH")': " $ if home_node .nes. "" $ then $ define/nolog DEMO$PATH "''F$EDIT(home_node,"UPCASE,COLLAPSE")'" $ endif $ endif $ $! $! Get the destination directory $! $ gosub CHECK_VMS_DIRECTORY $ $ CHECK_CDD_DIRECTORY: $! $! Check if CDD node is present $! $ w "" $ w " >> Checking CDD/Repository for current database of same name" $ w "" $ $ on error then goto CONT_CDD $ define/nolog/user SYS$OUTPUT NL: $ dictionary operator directory DEMO$PATH.'db_name' $ goto CDD_ERROR_2 $ $! $! No problem with CDD node. Continue. $! $ CONT_CDD: $ w " >> Creating database - " $ w " >> CDD/Repository integration to occur later in procedure" $ w "" $ $ gosub CREATE_DATABASE $ $ goto LOAD_DB $ $! $!------------------------------------------------------------ $ NO_CDD: $! $! Get the destination directory $! $ gosub CHECK_VMS_DIRECTORY $ $! $! Create database using file name PERSONNEL, (or CORPORATE_DATA, if it's $! a multischema database) $! $ w "" $ w " >> Creating database in specified directory" $ w "" $ $ gosub CREATE_DATABASE $! $ if (use_msdb) then goto WRAP_UP $! $!------------------------------------------------------------ $ LOAD_DB: $! $! Loading data to PERSONNEL $! $ w "" $ w " >> Loading ",DB_NAME," database from data files" $ w "" $ $ define/nolog SQL_PERSONNEL DEMO$DB_NAME $ define/nolog PERSONNEL DEMO$DB_NAME $ demo_define_used = TRUE $ $! $! Storing Employees Relation $! $ run rdm$demo:'prefix'employees $! $! Storing Jobs Relation $! $ run rdm$demo:'prefix'jobs $! $! Storing Departments Relation $! $ run rdm$demo:'prefix'depts $! $! Storing Job_History Relation $! $ run rdm$demo:'prefix'jobhist $! $! Storing Salary_History Relation $! $ run rdm$demo:'prefix'salhist $! $! Storing Colleges Relation $! $ run rdm$demo:'prefix'colleges $! $! Storing Degrees Relation $! $ run rdm$demo:'prefix'degrees $! $! $ set noon !** $ $ ! $ ! Dates used in the definition procedures will be the VMS default format $ ! $ define/nolog/user LIB$DT_INPUT_FORMAT "!DB-!MAAU-!Y4 !H04:!M0:!S0.!C2" $ $ if (utility .eqs. "RDO") $ then $ ! $ ! Define indexes (for the multi-file database some hash indexes $ ! are defined before the data is loaded), constraints, triggers. $ ! $ if (db_type .eqs. "S") $ then $ define/nolog/user RDOINI NL: $ demo$rdo SET OUTPUT DEMO$DIR:PERSONNEL$2.LOG SET LANGUAGE ENGLISH INVOKE DATABASE FILENAME "DEMO$DB_NAME" @RDM$DEMO:PERSONNEL_INDEXES_RDO.RDO @RDM$DEMO:CONSTRAINTS_RDO.RDO @RDM$DEMO:TRIGGERS_RDO.RDO $ else $ define/nolog/user RDOINI NL: $ demo$rdo SET OUTPUT DEMO$DIR:PERSONNEL$2.LOG SET LANGUAGE ENGLISH INVOKE DATABASE FILENAME "DEMO$DB_NAME" @RDM$DEMO:MF_PERSONNEL_INDEXES_RDO.RDO @RDM$DEMO:CONSTRAINTS_RDO.RDO @RDM$DEMO:TRIGGERS_RDO.RDO $ endif $ else $ ! $ ! Define indexes (for the multi-file database some hash indexes $ ! are defined before the data is loaded) and triggers. $ ! $ if (db_type .eqs. "S") $ then $ define/nolog/user SQLINI NL: $ demo$sql PRINT 'Creating indexes and triggers and loading the list data.'; SET OUTPUT DEMO$DIR:PERSONNEL$2.LOG SET LANGUAGE ENGLISH ATTACH 'FILENAME DEMO$DB_NAME RDB041'; @RDM$DEMO:INDEXES.SQL @RDM$DEMO:TRIGGERS.SQL @RDM$DEMO:LIST.SQL $ else $ define/nolog/user SQLINI NL: $ demo$sql PRINT 'Creating indexes and triggers and loading the list data.'; SET OUTPUT DEMO$DIR:PERSONNEL$2.LOG SET LANGUAGE ENGLISH ATTACH 'FILENAME DEMO$DB_NAME RDB041'; @RDM$DEMO:MF_INDEXES.SQL @RDM$DEMO:TRIGGERS.SQL @RDM$DEMO:LIST.SQL $ endif $ endif $ $ if use_dictionary $ then $ w "" $ w " >> Integrating database into CDD/Repository" $ ! $ ! Always use SQL for integrate, as there is no need to differentiate $ ! between languages once the actual database has been defined. $ ! $ open/write sqlcom tmp.sql $ write sqlcom "INTEGRATE DATABASE FILENAME ''F$TRNLNM("DEMO$DB_NAME")'" $ write sqlcom " CREATE PATHNAME DEMO$PATH.''DB_NAME';" $ write sqlcom "commit;" $ close sqlcom $ define/nolog/user SQLINI NL: $ define/nolog/user SYS$OUTPUT NL: $ demo$sql @tmp exit $ delete tmp.sql; $ endif $ $! $! Normal end of command procedure $! $ WRAP_UP: $ w "" $ w " >> End of command procedure." $ w "" $ w " >> Examine the log file in ",F$TRNLNM("DEMO$DIR")," for the" $ w " >> database definitions and errors that may have occurred during" $ w " >> the database creation. The log file is named PERSONNEL.LOG" $ w " >> for the single-file or multifile database and" $ w " >> CORPORATE_DATA.LOG for the multischema database." $ w "" $ w " >> The RDM$DEMO directory contains all the files used in building this" $ w " >> sample database." $ w "" $ $ EXIT_BUILD: $! $! Create log file; deassign all logical names and symbols used. $! $ if F$SEARCH("DEMO$DIR:PERSONNEL$2.LOG") .nes. "" $ then $ append/nolog demo$dir:personnel$2.log demo$dir:personnel.log $ delete/nolog/noconfirm demo$dir:personnel$2.log;* $ endif $ $ if F$TRNLNM("DEMO$DB_NAME") .nes. "" then deassign DEMO$DB_NAME $ if F$TRNLNM("DEMO$DIR") .nes. "" then deassign DEMO$DIR $ if F$TRNLNM("DEMO$PATH") .nes. "" then deassign DEMO$PATH $ $ if demo_define_used $ then $ if F$TRNLNM("PERSONNEL") .nes. "" then deassign PERSONNEL $ if F$TRNLNM("SQL_PERSONNEL") .nes. "" then deassign SQL_PERSONNEL $ endif $ $ if F$TYPE(DEMO$RDO) .nes. "" then delete/symbol/global demo$rdo $ if F$TYPE(DEMO$SQL) .nes. "" then delete/symbol/global demo$sql $ exit $ $! $!------------------------------------------------------------ $ CHECK_VMS_DIRECTORY: $! $! Get the VMS directory $! $ w "" $ w " Enter VMS directory specification for the database files" $ w "" $! $ if (dir_spec .eqs. "") $ then $ if f$mode() .eqs. "BATCH" $ then $ ! $ ! Use the default directory $ ! $ home_directory = "''F$ENVIRONMENT("DEFAULT")'" $ else $ read sys$command/END=EXIT_BUILD home_directory - /prompt="Directory; default is ''F$TRNLNM("DEMO$DIR")': " $ if home_directory .nes. "" $ then $ ! $ ! Use the directory entered by the user $ ! $ home_directory = F$EDIT(home_directory, "UPCASE,COLLAPSE") $ define/nolog DEMO$DIR "''home_directory'" $ define/nolog DEMO$DB_NAME "''home_directory'''DB_NAME'" $ endif $ endif $ else $ ! $ ! Use the directory spec parameter supplied by the user $ ! $ home_directory = F$EDIT(dir_spec,"UPCASE,COLLAPSE") $ define/nolog DEMO$DIR "''home_directory'" $ define/nolog DEMO$DB_NAME "''home_directory'''DB_NAME'" $ endif $! $! Check whether the database already exists in this directory (if yes: error) $! $ db_file_spec = home_directory + db_name + ".RDB" $ if F$SEARCH(db_file_spec) .nes. "" then goto DB_EXISTS $ $ return $! $!------------------------------------------------------------ $ CREATE_DATABASE: $! $! Create the database using the specified utility in the appropriate $! file format (single or multi-file). Check to see if it is to be a multi- $! schema database. If so, bypass file format checks for time being, since $! we only build a single-file multischema database, (use appropriate utilities $! to create database). $! $ ! $ ! Dates used in the definition procedures will be the VMS default format $ ! $ define/nolog/user LIB$DT_INPUT_FORMAT "!DB-!MAAU-!Y4 !H04:!M0:!S0.!C2" $ $ if (use_msdb) $ then $ define/nolog/user SQLINI NL: $ demo$sql PRINT 'Creating multischema corporate_data database'; SET OUTPUT DEMO$DIR:CORPORATE_DATA.LOG SET LANGUAGE ENGLISH CREATE DATABASE FILENAME 'DEMO$DB_NAME' MULTISCHEMA IS ON; DISCONNECT ALL; ATTACH 'FILENAME DEMO$DB_NAME RDB041 MULTISCHEMA IS ON'; @RDM$DEMO:MSDB_CREATE_DATABASE.SQL $ @RDM$DEMO:MSDB_DATA_LOAD.COM $ demo$sql SET OUTPUT DEMO$DIR:CORPORATE_DATA$2.LOG ATTACH 'FILENAME DEMO$DB_NAME RDB041 MULTISCHEMA IS ON'; SET LANGUAGE ENGLISH PRINT ' Creating indexes.'; @RDM$DEMO:MSDB_INDEXES.SQL $ return $ endif $ $ if utility .eqs. "RDO" $ then $ if (db_type .eqs. "S") $ then $ define/nolog/user RDOINI NL: $ demo$rdo ! ! Create single file database WITH CDD/Repository ! SET OUTPUT DEMO$DIR:PERSONNEL.LOG SET LANGUAGE ENGLISH DEFINE DATABASE "DEMO$DB_NAME" DICTIONARY IS NOT USED. @RDM$DEMO:BUILDPERS_RDO.RDO $ else $ define/nolog/user RDOINI NL: $ demo$rdo ! ! Create multi-file database ! SET OUTPUT DEMO$DIR:PERSONNEL.LOG SET LANGUAGE ENGLISH @RDM$DEMO:RDO_DEFINE_STORAGE.RDO @RDM$DEMO:MF_BUILDPERS_RDO.RDO $ endif $ else $ if (db_type .eqs. "S") $ then $ define/nolog/user SQLINI NL: $ demo$sql ! ! Create single file database ! PRINT 'Creating single-file personnel database.'; SET OUTPUT DEMO$DIR:PERSONNEL.LOG SET LANGUAGE ENGLISH CREATE DATABASE FILENAME 'DEMO$DB_NAME'; DISCONNECT ALL; ATTACH 'FILENAME DEMO$DB_NAME RDB041'; @RDM$DEMO:BUILDPERS.SQL $ else $ define/nolog/user SQLINI NL: $ demo$sql ! ! Create multi-file database ! PRINT 'Creating multifile mf_personnel database.'; SET OUTPUT DEMO$DIR:PERSONNEL.LOG SET LANGUAGE ENGLISH CREATE DATABASE FILENAME DEMO$DB_NAME @RDM$DEMO:SQL_CREATE_STORAGE.SQL ATTACH 'FILENAME DEMO$DB_NAME RDB041'; @RDM$DEMO:MF_BUILDPERS.SQL $ endif $ endif $ return $! $!------------------------------------------------------------ $! ERROR Handling $!------------------------------------------------------------ $ DB_EXISTS: $ w error_banner $ w "The database ",F$TRNLNM("DEMO$DB_NAME")," already exists" $ goto EXIT $ $ BAD_P1: $ w error_banner $ w "Interface language (P1): You must specify SQL or RDO," $ w " or leave blank (default = SQL)." $ goto EXIT $ $ BAD_P2: $ w error_banner $ w "Database type (P2): You must specify S (single-file) or $ w " M (multifile), or leave blank (default = S)." $ goto EXIT $ $ BAD_P3: $ w error_banner $ w "Dictionary use (P3): You must specify CDD or NOCDD, or leave blank" $ w " (if blank, you will be prompted)" $ goto EXIT $ $ BAD_P4: $ w error_banner $ w "Multischema db use (P4): You must specify MSDB, or leave blank" $ w " (default blank)" $ goto EXIT $! $ BAD_MSDB: $ w error_banner $ w "Multischema database specifed in P4. P1 must equal "SQL", P2 must" $ w " equal "S", and P3 must equal "NOCDD".. at this time" $ $ goto EXIT $! $ BAD_CDD_MSDB: $ w error_banner $ w "Cannot use CDD with a Multischema database at this time - " $ w "You must answer NO for CDD/Repository usage." $ goto EXIT $! $ CDD_ERROR_1: $ w error_banner $ w "CDD/Repository not found, you must answer NO for data dictionary usage." $ goto EXIT $ $ CDD_ERROR_2: $ w error_banner $ w "An object named ",DB_NAME," already exists", - " in the CDD/Repository directory ",F$TRNLNM("DEMO$PATH") $ goto EXIT $ $ BAD_DEMO: $ w error_banner $ w "The system logical name RDM$DEMO has not been defined. Please" $ w "have your system manager start Oracle Rdb before using this procedure." $ goto EXIT $ $ EXIT: $ if save_verify then set verify $ abort