Previous Topic: Open the Database and the Input Unload File

Next Topic: Build Field Definitions

Check Database Attributes

You must now ensure that the destination database can support the reload. Check the following:

These tests could be relaxed in a full-function reload.

The code to perform the verification is as follows:

&NDBINFO &DBNAME DB                 -* get info about dest
&FILE GET SEQ ARGS                  -* read next record
                                    -* (02)
&IF .&1 NE .02 &THEN &GOTO .READERR -* validate
&IF &NDBDBVKL LT &3 &THEN &DO       -* dest keylen short
   &WRITE destination key length short, load aborted
   &END 16
&DOEND
&IF &NDBDBNFLDS NE 0 &THEN &DO      -* dest db has fields
   &WRITE destination database has fields defined, +
      load aborted
   &END 16
&DOEND
&IF &NDBDBNRECS NE 0 &THEN &DO      -* dest db has records
   &WRITE destination database has records present, +
      load aborted
   &END 16
&DOEND
&IF &NDBDBNRID  NE 0 &THEN &DO      -* dest not just
                                    -* created
   &WRITE destination database not freshly created, +
      load aborted
   &END 16
&DOEND