DBCREATE
Name
DBCREATE
Purpose
Create a new data base (.dbf), index (.dbx) or description (.dbh) file
Explanation
A database definition (.dbd) file must already exist in the current
directory or in a ZDBASE directory. The new .dbf, .dbx and/or .dbh
files will be written to the same directory. So if the .dbd file is
in a ZDBASE directory, then the user must have write privilege to that
directory
This version allows record length to be larger than 32767 bytes
Calling Sequence
dbcreate, name,[ newindex, newdb, maxitems] [,/EXTERNAL, MAXENTRY=]
Inputs
name- name of the data base (with no qualifier), scalar string.
The description will be read from the file "NAME".dbd
Maximum length of name is 19 characters.
Optional Inputs
newindex - if non-zero then a new index file is created,
otherwise it is assumed that changes do not affect the
index file. (default=0)
newdb - if non-zero then a new data base file (.dbf) will
be created. Otherwise changes are assumed not to affect
the file's present format.
maxitems - maximum number of items in data base.
If not supplied then the number of items is
limited to 200.
Outputs
NONE.
Optional Input Keywords
external - If set, then the database is written with an external data
representation. This allows the database files to be used on
any computer platform, e.g. through NFS mounts, but some
overhead is added to reading the files. The default is to
write the data in the native format of the computer being used.
This keyword is only paid attention to if NEWDB or NEWINDEX
are nonzero. Otherwise, the database is opened to find
out if it uses external representation or not.
Extreme caution should be used if this keyword is used with
only NEWINDEX set to a nonzero value. This mode is allowed so
that databases written on machines which already use the
external data representation format, e.g. Sun workstations, to
be marked external so that other machines can read them.
MAXENTRY - positive integer giving the maximum number of entries in the
database (needed to adjust the size of the index file). This
keyword can be used to supercede the #maxentries line in the
.dbd file (the larger of the two numbers will be used).
Procedure Calls
GETTOK(), FIND_WITH_DEF(), ZPARCHECK
Restrictions
If newdb=0 is not specified, the changes to the .dbd file can
not alter the length of the records in the data base file.
and may not alter positions of current fields in the file.
permissible changes are:
1) utilization of spares to create a item or field
2) change in field name(s)
3) respecification of index items
4) changes in default print formats
5) change in data base title
6) changes in pointer specification to other data
data bases
!priv must be 2 or greater to execute this routine.
Side Effects
data base description file ZDBASE:name.dbh is created
and optionally ZDBASE:name.dbf (data file) and
ZDBASE.dbx (index file) if it is a new data base.
Revision History
D. Lindler, GSFC/HRS, October 1987
Modified: Version 1, William Thompson, GSFC, 29 March 1994
Version 2, William Thompson, GSFC/CDS (ARC), 28 May 1994
Added EXTERNAL keyword.
Version 4, William Thompson, GSFC, 3 November 1994
Modified to allow ZDBASE to be a path string.
8/14/95 JKF/ACC - allow EXTERNAL data for newindex OR newdb modes.
Make sure all databases closed before starting W. Landsman June 1997
Added new unsigned and 64 bit integer datatypes W. Landsman July 2001
Make sure to use lowercase filenames on Unix W. Landsman May 2006
Added MAXENTRY keyword W. Landsman July 2006
Assume since V5.5, remove obsolete keywords to OPEN W. Landsman Sep2006
No longer required to be a ZDBASE directory W. Landsman Feb 2008
Fix Feb 2008 bug when files are in current dir W. L. May 2008
Fix May 2008 bug when files are not in current dir (sigh) W. L. May 2008
Warn if database length exceeds 32767 bytes W.L. Dec 2009
Remove spurious warning that database name is too long W.L. April 2010
Support entry lengths larger than 32767 bytes W.L. Oct. 2010
Better testing for valid print formats W.L. Nov 2010