Previous Topic: Insert Field Definitions

Next Topic: Delete an NDB

Load Initial Data

If the database needs to have data loaded into it (for example, a table or reference database), then the data can be loaded using an NCL procedure to read the input data (for example, from a UDB, either a KSDS or an ESDS), and use &NDBADD to add it to the NDB.

If a large amount of data is to be loaded this way, then use the DEFER option of the NDB START command to prevent buffer flushing during the load.

When the load completes successfully, use an NDB START NODEFER command to remove the defer status. There is no need to stop and restart the database.

Another way to speed up loading of large amounts of data is to create or start the database in LOAD MODE. In this case, no keys are manipulated while loading, making the load run much faster.

The NDB ALTER command must then be used to build all keys in a single pass.

Note: If a region failure occurs while an NDB is open in DEFER mode, then it is flagged as unusable, and must be restored or recreated.

If the database is in LOAD MODE, it must have an NDB ALTER command run against it to build keys.

The load program should use the EXCLUSIVE option of the &NDBOPEN statement to prevent other users accessing the database while it is running.

The progress of the load program can be monitored by periodic use of the SHOW NDB=dbname command. This command displays information about the database, including the number of database requests executed (this is the sum of NDB commands and &NDB NCL statements) since it last started.

This completes the process of initialization (and initial loading) of an NDB. The tasks are the same as required for any other UDB, except for the NDB CREATE and field definition tasks.

Most of the initialization tasks can be combined into one NCL procedure, using &INTCMD/&INTREAD to issue and check the commands, and &NDBxxx statements to perform the definition and load. In a z/OS or MSP environment, UTIL0007 can be used to perform the VSAM DELETE/DEFINE from NCL.