Describing database files

You can use several methods to describe IBM i database files. This topic discusses how to describe a database file with data description specifications (DDS) because DDS has the most options for defining data.

If you want to describe a file just to the record level, you can use the record length (RCDLEN) parameter on the Create Physical File (CRTPF) and Create Source Physical File (CRTSRCPF) commands. If you want to describe your file to the field level, several methods can be used to describe data to the database system: interactive data definition utility (IDDU), Structured Query Language (SQL) commands, or data description specifications (DDS).

Interactive data definition utility (IDDU)

Physical files can be described with IDDU. You might use IDDU because it is a menu-driven, interactive method of describing data. You might be familiar with describing data using IDDU in a System/36 environment. In addition, IDDU allows you to describe multiple-format physical files for use with IBM Query for i, IBM i Access, and the data file utility (DFU).

When you use IDDU to describe your files, the file definition becomes part of the IBM i data dictionary.

Db2 for i Structured Query Language (SQL)

SQL can be used to describe a database file. It supports statements to describe the fields in the database file and to create the file.

SQL was created by IBM to meet the need for a standard and common database language. It is currently used on all IBM® DB2® platforms and on many other database implementations from many different manufacturers.

When you create a database file using the Db2 for i SQL, the file description is automatically added to a data dictionary in the SQL schema. The data dictionary (or catalog) is then automatically maintained by the system.

SQL is the language of choice for accessing databases on many other platforms. It is the only language for distributed databases and heterogeneous systems.

Data description specifications (DDS)

Externally described files can be described with DDS. DDS provides descriptions of the field-level, record-level, and file-level information.

You might use DDS because it provides the most options for the programmer to describe data in the database. For example, only with DDS can you describe key fields in logical files.

The DDS form provides a common format for describing data externally. DDS data is column sensitive. The examples that follow have numbered columns and show the data in the correct columns.

After a database file is described, you can view the description.