5 Database Utilities
If exporting into multiple files the contents of each data set is written into a separate file. These export files are named database_name.dataset_number.exp. This is the default export mode. We recommend using a directory to hold all export files of a database.
If exporting into a single file, you can choose any filename or stdout.
The dbexport command must be executed from the operatind system prompt. Syntax of the command is as follows:
dbexport [options] database [data set [ data set ] . . .] ] ]
Options:
dbexport -p secret -v -o sadexp SADThis command exports the data from all SAD data sets to export files (SAD.03.exp, SAD.04.exp, SAD.05.exp, and SAD.06.exp). SAD data sets 01 and 02 are defined in the root file as automatic data sets and are therefore not exported. The -o sadexp option specifies that the export files are to be created in the sadexp directory. The -p secret option specifies the user password.
NOTE: Data sets of type automatic master are filled automatically by dbimport. These data sets are not exported by dbexport, unless option -a is used with dbexport. However, automatic sets are not imported from exported files, but are built up during the loading of corresponding detail data.
Display:
B1368B DBEXPORT (C) COPYRIGHT MARXMEIER SOFTWARE AG 2002 (A.06.00) Processing database : SAD Export path : sadexp DATA SET Records Count ---------------- -- - -------- -------- DATE 01 A 11 ORDER 02 A 11 PRODUCT 03 M 5 5 LOCATION 04 M 1 1 OPTION 05 D 16 16 CUSTOMER 06 D 11 11 | | | | | Data Set Name | | | Number of exported entries counted | | | | | Number of entries in the data set | | | Data Set Type | A = Automatic Master | M = Manual Master | D = Detail | Data Set NumberNOTE: If a data set contains no entries, no export file will be created for that data set.
NOTE: Files to be imported must have the naming format databasename.datasetnumber.exp. Therefore, if you use an application program to dump data to a file that you plan to use dbimport on later, make sure that data is dumped to a file named databasename.datasetnumber.exp.
The dbimport command must be executed from the operating system prompt. Syntax of the command is as follows:
dbimport [options] database [data set [ data set ] . . .] ] ]
Options:
dbimport -v -i sadexp -p secret SADThis command imports the data from the SAD export files (SAD.03.exp, SAD.04.exp, SAD.05.exp, and SAD.06.exp) into the .idx and .dat files created using dbcreate. SAD data sets 01 and 02 are defined in the root file as automatic data sets and are therefore filled automatically when dbimport is executed.
The -i sadexp option specifies that the export files are in the sadexp directory. The -p secret option specifies the user password.
Display:
B1368B DBIMPORT (C) COPYRIGHT MARXMEIER SOFTWARE AG 2002 (A.06.00) Processing database: SAD Import path : sadexp DATA SET Count ---------------- -- - -------- DATE 01 A ORDER 02 A PRODUCT 03 M 5 LOCATION 04 M 1 OPTION 05 D 16 CUSTOMER 06 D 11 | | | | Data Set Name | | Number of imported entries counted | | | Data Set Type | A = Automatic Master | M = Manual Master | D = Detail | Data Set NumberNOTE: If you attempt to import a file that does not follow the naming conventions databasename.datasetnumber.exp, the following message appears: export file name: No such file or directory.
NOTE: If a detail data set contained no entries, no export file will be created for that data set and the following message appears: export file name: No such file or directory.
IMPORT SET data set [ = data set] { item spec = item spec; item spec = :NULL; item spec = :CONST constant; ... }
this will specify all elements
ITEM [1]
this will specify first element
ITEM [1-3]
this will specify elements 1 to 3
NOTE: For the database to be loaded, data set/item names are taken from the ROOT file. For the export file(s) the data set/item names are saved by the dbexport utility if run with the -r option. If no data set/item names are saved in the export file(s) (dbexport not run with -r option) you have to specify each item that has a different position in the export set.
T_NUMBER = positive integer constant import_spec: /* empty */ | set_spec import_spec set_spec: IMPORT SET to_set from_set set_spec_item_part set_spec_item_part: /* empty */ | "{" item_spec_list "}" to_set: /* target set */ set name | set number from_set: /* set in import file */ /* empty */ | "=" set name | "=" set number item_spec_list: /* empty */ | item_spec item_spec_list item_spec: /* item conversion spec */ to_spec "=" from_spec ";" to_spec: /* target item (range) */ to_item range_spec to_item: item name | item number from_spec: T_NUMBER /* field number in exported record */ | item_name /* or exported field name (range) */ | ":NULL" /* NULL (default) value */ | ":CONST" T_NUMBER /* integer constant */ | ":CONST" string_in_quotes /* string constant */ range_spec: /* array element range */ /* empty */ | "[" T_NUMBER "]" | "[" T_NUMBER "-" T_NUMBER "]"
# Import set CUSTOMER from ACCOUNTS IMPORT SET CUSTOMER = ACCOUNTS # Fill PRODUCT from ORDER IMPORT SET PRODUCT = ORDER { PRODUCT-NO = ORDER-NO; PROD-DESC = :CONST "* Unknown *"; # all other default }
New database layout ... Old database layout ... ITEMS: ITEMS: ORDER-NO, X8; ORDER-NO, X8; PRODUCT-NO, X6; PRODUCT-NO, X6; QUANTITY, I; QUANTITY, I; SHIPMENT-DATE, X4; SHIPMENT-DATE, X4; QTY-AVAIL, I; ARRAY, 3I; ARRAY, 4I; SETS: SETS: N: ORDER-DETAIL D(/0); N: PRODUCTION D (/0); E: ORDER-NO, E: ORDER-NO, PRODUCT-NO, PRODUCT-NO, QUANTITY, QUANTITY, SHIPMENT-DATE, SHIPMENT-DATE, QTY-AVAIL, ARRAY; ARRAY;
Figure 8 Example of new layout
Database reload process...
You want to load your new data set ORDER-DETAIL from your old data set PRODUCTION. All data items should be taken from the the old data set with the following exceptions:
IMPORT SET ORDER-DETAIL = PRODUCTION { QTY-AVAIL = QUANTITY; QUANTITY = :NULL; SHIPMENT-DATE = :CONST "0000"; ARRAY[1-2] = ARRAY[1-2]; ARRAY[4] = ARRAY[3]; ARRAY[3] = :CONST 1; }