Obtain Information About an NDB

The &NDBINFO verb lets you obtain information about the current state of an NDB, or any of the defined fields in an NDB.

To obtain information about the database, code:

&NDBINFO dbname DB

This statement sets several user NCL variables, prefixed by &NDBDB, with database information.

For more information about the fields, see the &NDBINFO verb description in the Network Control Language Reference Guide. Useful fields are:

These fields can be used to determine if two NDBs are compatible (for example, for backup purposes).

The &NDBINFO verb also allows retrieval of information about fields defined in the database. Information can be retrieved about a field with a specific name, or by relative field number, where the number is from 1 to the value returned in &NDBDBNFLDS. This relative number is not fixed, but changes as field definitions are added and deleted. For this reason, inquiry by number should only be used in a loop (from 1 to &NDBDBNFLDS), with the database open EXCLUSIVE.

To retrieve information about a specific field, where the name is known, code:

&NDBINBFO dbname NAME=fieldname

To retrieve information about relative field number n, code:

&NDBINFO dbname NUMBER=n

In both cases, information is returned in several user NCL variables, prefixed by &NDBFLD. Following are several useful variables.

For more information about the returned variables, see the description of the &NDBINFO verb in the Network Control Language Reference Guide.

This information can be used in a table-driven database query and update program to edit or display data without needing to code specific details about each NDB. It is also useful for unload and reload programs.


Copyright © 2010 CA. All rights reserved.