For relational datastores, a file specified for a DESCRIPTION command can contain an SQL SELECT statement listing the columns to be selected. This is the SQLDML description type, which allows the relational datastore descriptions to be retrieved directly from the database catalog. This method can be used as an alternative to using relational DDL descriptions (SQLDDL).
Using an SQL SELECT statement as the description allows for specifying relational views as datastores, and enables you to utilize SQL functions whose results define the columns (fields) of the datastore.
If an SQL SELECT is used to describe a datastore record layout, the Parser must have connectivity to the relational database where the table or view being described resides. The RDBMS command must be used to provide the information to connect to the specific relational database on all systems, other than DB2 on the mainframe (z/OS), which uses the DB2 Call Attach Facility to handle the connection.
The following diagram illustrates a one-to-one and a one-to-many DESCRIPTION to DATASTORE relationship using the RDBMS command.
Example
RDBMS DB01 userid password;
DESCRIPTION SQLDML /users/sqdata/select.dml
AS TABLE_DESC;
DATASTORE CUSTOMER
OF RELATIONAL
AS CUSTOMER_IN
DESCRIBED BY TABLE_DESC;
When the Parser processes the script, a connection is made to the database DB01 and the description for the CUSTOMER table will be returned as a two (2) columns (NAME and ADDRESS).