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:
Contains the current number of records in the database.
Contains the current number of fields defined in the database.
Contains the VSAM key length of the database.
Contains the VSAM maximum record length of the database.
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.
Contains the name of the field (useful when retrieving by relative number)
Contains the format of the field, for example, CHAR
Contains the key option for the field, for example, UNIQUE
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 © 2011 CA. All rights reserved. | Tell Technical Publications how we can improve this information |