Previous Topic: Reload an NDB from an Unload File

Next Topic: Check Database Attributes

Open the Database and the Input Unload File

The procedure must first open the database, and the input unload file. It is assumed that the procedure is invoked from OCS with the name of the NDB and the name of the unload file:

$NDBRELD dbname esdsname

To speed up the reload, start the NDB in DEFER mode. This mode inhibits the database manager from flushing buffers after each &NDBADD, at the expense of an unusable database if the system fails while open this way. To set DEFER mode, the database must have been opened by the UDBCTL command with the options LSR and DEFER. The following NDB command causes deferred I/O:

NDB START &DBNAME DEFER

Note: The NDB START command can be issued at any time.

Set &CONTROL NOUCASE to protect lower case data:

&CONTROL NOUCASE

Open the database in exclusive mode, to prevent other users accessing it while it is being reloaded:

&DBNAME = &1                     -* save db name to reload
&RLNAME = &2                              -* save esds name
&NDBOPEN &dbname EXCLUSIVE
&IF &NDBRC NE 0 &THEN &GOTO .OPENERROR    -* unable to open
&FILE OPEN &RLNAME
&IF &FILERC GT 8 &THEN &GOTO .OPENERROR    -* unable to open

You must now verify the input file. Read the initial load record (and ignore it), and the second record, which should be the header record:

&FILE GET SEQ ARGS               -* should be initld record
&IF &FILERC NE 0 &THEN &GOTO .READERR
&FILE GET SEQ ARGS               -* should be 01 ndb ....
&IF &FILERC NE 0 &THEN &GOTO .READERR
&IF &1.&2.&3.&4.  NE 01.NDB.UNLOAD.OF. +
    &THEN &GOTO .BADFILE
&INDBNAME = &5
&INULDATE = &6
&INULTIME = &7
&WRITE RELOAD FROM BACKUP OF &INDBNAME TAKEN &INULDATE +
      &INULTIME