The HEASARC Database System

Export Software

Using HDBexgest:

HDBexgest (/heasarc/bin/HDBexgest on dbsrv.gsfc.nasa.gov) will export a HEASARC database table to an ASCII file of the same format that HDBingest uses.

Please note that you must be a valid Ingres user in order to use this program if you are using Ingres as your DBMS. If you are using Sybase, then you need to set the SYBASE_USER and SYBASE_PASSWORD environment variables to that of a valid Sybase account with sufficient privileges to modify the database. Unfortunately, there is no easy way to query if a person is a valid Ingres user or not, so HDBexgest will print a lot of strange error messages if you attempt to use this program without being a valid Ingres user or without having set the appropriate Sybase environment variables.

Once you have determined that you are a valid Ingres user and can use HDBexgest, you are required to set the EXGEST_TMPDIR enviroment variable. Setting it to /tmp or the current working directory is probably sufficient. This environment variable specifies the directory where HDBexgest will store some temporary files. All such temporary files will be deleted, unless there is an error of some kind.

Other environment variables you can set are:

HEASARC_DATABASE : Optional. This is the database from which HDBexgest will export the data. Default is "heasarc". This database *must* already have all the metabase tables properly set up.

HDB_PORT : Optional. This is the port number of the metabase server. Default is 40975 which is the metabase server for the "heasarc" database.

EXGEST_OUTDIR : Optional. You can optionally set this environment variable, and all files are then exported to that directory.

Usage:

HDBexgest [-header] [-o (directory|-)] table_name [...]

Examples:

% HDBexgest heasarc_class
Table "heasarc_class" exported to file ./heasarc_class-19950601-1659.tdat.

It should be pointed out that the name of the created file is as follows:

table_name-YYYYMMDD-hhmm.tdat

where YYYY is the year, MM is the month, DD is the day, hh is the hour, and mm is the minute in which the file was created. It's kind of ugly, but the thought was that a timestamp as part of the filename would be useful.

% HDBexgest -o /some/directory heasarc_a1 heasarc_class
Table "heasarc_a1" exported to file /some/directory/heasarc_a1-19950601-1705.tdat.
Table "heasarc_class" exported to file /some/directory/heasarc_class-19950601-1705.tdat.

The "-o" option allows you to specify the location in which the exported files are created. Also, note that you can specify multiple tables, and each is "exgested" in order.

% HDBexgest -o - heasarc_ascapublic | more

Specifying a "-" instead of "/some/directory" when using the "-o" option causes the output to go to stdout instead of a file. Note: using "-o -" in conjuction with specifying multiple tables results in only the first table being processed. (Sending more than one table at a time to stdout is nonsensical anyway.)

% HDBexgest "zz*"
Table "zzext" exported to file ./zzext-19950601-1709.tdat.
Table "zzgen" exported to file ./zzgen-19950601-1709.tdat.
Table "zzpar" exported to file ./zzpar-19950601-1709.tdat.
Table "zzrel" exported to file ./zzrel-19950601-1709.tdat.

This shows that wildcards ("*") can be used to specify multiple tables to "exgest". Indeed, the command `HDBexgest "*"` would exgest all tables in the database "heasarc". (Not recommended.) Note: using "-o -" in conjuction with specifying multiple tables using wildcards processes only the table that comes first alphabetically.

% HDBexgest -header -o . "heasarc_ros*"
Header for table "heasarc_rosao" exported to file ./heasarc_rosao.hdr.
Header for table "heasarc_rosatlog" exported to file ./heasarc_rosatlog.hdr.
Header for table "heasarc_rosatsrc" exported to file ./heasarc_rosatsrc.hdr.
Header for table "heasarc_rosdistrib" exported to file ./heasarc_rosdistrib.hdr.
Header for table "heasarc_rosid" exported to file ./heasarc_rosid.hdr.
Header for table "heasarc_rosobs" exported to file ./heasarc_rosobs.hdr.
Header for table "heasarc_rospublic" exported to file ./heasarc_rospublic.hdr.
Header for table "heasarc_rosstl" exported to file ./heasarc_rosstl.hdr.

Using the "-header" option causes HDBexgest to only export the header portion of the TDAT file. It can be used in conjunction with any of the above options, and it applies to all the tables specified on the command line. Please note that a timestamp is not included as part of the filename for the ".hdr" file that is created, so any file that already exists in the output directory with the same name will be overwritten.

Setting the EXGEST_OUTDIR environment variable EXGEST_OUTDIR will cause all files to be created in that directory. Again, that's optional. The intention is that the user won't have to first change directories or specify the output directory with the "-o" option every time he/she wants to export a table. The "-o" option overrides the environment variable. If you don't set it, then the file is created in the current working directory or the directory specified by the "-o" option (if there is one).


Documentation prepared by the HEASARC Database Group

HEASARC Home | Observatories | Archive | Calibration | Software | Tools | Students/Teachers/Public

Last modified: Thursday, 17-Jun-2004 22:25:58 EDT