Creating a new database

The following example shows how to create a new database file.

                   Creating a new database file
                                  

      PROGRAM CDEXA1
*     ==============
*
*     Create a new, empty database
*
      PARAMETER   (NWPAW=100000)
      COMMON/PAWC/PAW(NWPAW)
*
*     Initialise Zebra, HBOOK and HEPDB
*
      CALL CDPAW(NWPAW,NHBOOK,IDIV,'USR-DIV',5000,50000,'ZPHU',IRC)
*
*     Unit for database access
*
      LUNCD  = 1
*
*     Database parameters
*
      NPAIR  = 1
      NREC   = 20000
      NTOP   = 1
*
*     Accept default record length (1024 words)
*
      LRECL  = 0
      CALL CDNEW(LUNCD,'HEPDB','HEPDB.DBS',IDIV,NPAIR,NREC,NTOP,
     +           LRECL,' ',IRC)
*
*     Set the log level
*
      CALL CDLOGL(' ',3,'A',IRC)
*
*     Terminate
*
      CALL CDEND(' ','A',IRC)
      END

The same result can be achieved by running the CDMAKE program, e.g. using the following script.

                   Script to run CDMAKE program
                                  

#
# Make a new database
#
# export CDFILE='name of the database file'
  export CDFILE='test.dbs'
# export CDPAIR='number of validity range pairs'
  export CDPAIR=1
# export CDPRE='number of records to be preformatted'
  export CDPRE=100
# export CDTOP='numeric ID for database'
  export CDTOP=1
# export CDQUO='number of records for database quota'
  export CDQUO=65000
# export CDRECL='record length of database file (words)'
  export CDRECL=1024
#
# now run the job
#
  /cern/pro/bin/cdmake