<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta name="Copyright" content="Copyright (c) 2006 by IBM Corporation"> <title>Generate Data Definition Language (QSQGNDDL) API</title> <!-- Begin Header Records --> <!-- All rights reserved. Licensed Materials Property of IBM --> <!-- US Government Users Restricted Rights --> <!-- Use, duplication or disclosure restricted by --> <!-- GSA ADP Schedule Contract with IBM Corp. --> <!-- Created by Mark Anderson for V5R1--> <!-- Change History: --> <!-- YYMMDD USERID Change description --> <!-- File Edited March 2001 --> <!-- This file has undergone html cleanup on 9/20/01 by JET --> <!-- End Header Records --> <link rel="stylesheet" type="text/css" href="../rzahg/ic.css"> </head> <body> <a name="Top_Of_Page"></a> <!--Java sync-link--> <script language="Javascript" src="../rzahg/synch.js" type="text/javascript"> </script> <h2>Generate Data Definition Language (QSQGNDDL) API</h2> <div class="box" style="width: 80%;"> <br> Required Parameter Group:<br> <!-- iddvc RMBR --> <br> <table width="100%"> <tr> <td align="center" valign="top" width="10%">1</td> <td align="left" valign="top" width="50%">Input template</td> <td align="left" valign="top" width="20%">Input</td> <td align="left" valign="top" width="20%">Char(*)</td> </tr> <tr> <td align="center" valign="top">2</td> <td align="left" valign="top">Length of input template</td> <td align="left" valign="top">Input</td> <td align="left" valign="top">Binary(4)</td> </tr> <tr> <td align="center" valign="top">3</td> <td align="left" valign="top">Input template format name</td> <td align="left" valign="top">Input</td> <td align="left" valign="top">Char(8)</td> </tr> <tr> <td align="center" valign="top">4</td> <td align="left" valign="top">Error code</td> <td align="left" valign="top">I/O</td> <td align="left" valign="top">Char(*)</td> </tr> </table> <br> Default Public Authority: *USE<br> <!-- iddvc RMBR --> <br> Threadsafe: No<br> <!-- iddvc RMBR --> <br> </div> <p>The Generate Data Definition Language (QSQGNDDL) API generates the SQL data definition language statements required to recreate a database object. The results are returned in the specified database source file member.</p> <p>Database physical files or logical files that were created using an interface other than SQL may be specified. For example, files created from DDS and the CRTPF or CRTLF commands may be specified. Even if the object was created using SQL, the Standards option may restrict what can be generated. In either of these cases:</p> <ul> <li>the operation may succeed with warnings that are generated in the SQL statement source, or</li> <li>the operation may fail for certain non-relational files or objects not supported by the specified Standards option.</li> </ul> <p>If a database object was created using an SQL interface, the resulting SQL statements may be slightly different than the SQL statements that created the object originally. For example:</p> <ul> <li>When there is more than one way to specify an attribute in SQL, the more standard syntax is generally chosen. For example, if a user creates a table with a FLOAT(52) column, DOUBLE PRECISION is generated.</li> <li>When a clause is not specified in the original SQL statement and a default is taken instead, a clause may be generated to explicitly show the default. For example, if the default value for a nullable column is the null value, the clause DEFAULT NULL is generated.</li> <li>When a Standards option is used to restrict the generated SQL to the ANS and ISO standard or the DB2 Universal Database Family, an attribute may be omitted. For example, if the ALLOCATE clause is specified on a VARCHAR column, the ALLOCATE clause is not generated unless the Standards option allows DB2 UDB for iSeries extensions.</li> </ul> <p>For more information, see the Severity level field within the <a href= "#HDRTMPL1">SQLR0100 Format</a>.</p> <p>You can use the QSQGNDDL API with database objects only. DDM files (other than SQL aliases) are not supported. File overrides do not affect the specified object names. File overrides do affect the specified source file names.</p> <br> <h3>Authorities and Locks</h3> <dl> <dt><em>Object Library Authority</em></dt> <dd>*EXECUTE<br> <br> </dd> <dt><em>Source File Library Authority</em></dt> <dd>*EXECUTE<br> <br> </dd> <dt><em>Object Authorities</em></dt> <dd>*EXECUTE for *LIB objects.<br> *USE for the *DTADCT object in a library (if SCHEMA is specified for the object type).<br> *USE for *FILE objects (not including aliases).<br> *USE to QSYS2/SYSPARMS for functions and procedures.<br> *USE to QSYS2/SYSROUTINE for functions and procedures.<br> *USE to QSYS2/SYSTYPES for types.<br> *USE to QSYS2/SYSTABLES for aliases.<br> <br> </dd> <dt><em>Source File Authority</em></dt> <dd>*OPER and *ADD.<br> If replace is specified, *DLT and either *OBJMGT or *OBJALTER is required also.<br> <br> </dd> <dt><em>Object Lock</em></dt> <dd>*SHRRD for *LIB objects.<br> *SHRNUP for *FILE objects (not including aliases). (See note below.)<br> *SHRRD to QSYS2/SYSFUNCS for functions.<br> *SHRRD to QSYS2/SYSPARMS for functions and procedures.<br> *SHRRD to QSYS2/SYSPROCS for procedures.<br> *SHRRD to QSYS2/SYSTYPES for types.<br> *SHRRD to QSYS2/SYSTABLES for aliases.<br> <br> <p><strong>Note:</strong> If the object is a *FILE object, the lock is acquired only on the file definition and not the data. Applications that modify data can run concurrently with this API.</p> </dd> <dt><em>Source File Lock</em></dt> <dd>*EXCLRD.</dd> </dl> <br> <h3>Required Parameter Group</h3> <dl> <dt><strong>Input template</strong></dt> <dd>INPUT;CHAR(*)<br> <p>A structure that contains the input options used to generate DDL for the requested database object. For the format of this parameter, see <a href= "#HDRTMPL1">SQLR0100 Format</a>.</p> </dd> <dt><strong>Length of input template</strong></dt> <dd>INPUT; BINARY(4)<br> <p>A variable that contains the length of the input template. The length must be greater than zero and large enough to contain all the template fields up to and including the Header Option. The length must not be larger than 32767.</p> </dd> <dt><strong>Input template format name</strong></dt> <dd>INPUT; CHAR(8)<br> <p>The format of the input template being used. The possible value is:</p> <table cellpadding="5"> <!-- cols="15 85" --> <tr> <td align="left" valign="top"><em>SQLR0100</em></td> <td align="left" valign="top">Basic template</td> </tr> </table> <p>For more information, see <a href="#HDRTMPL1">SQLR0100 Format</a>.</p> </dd> <dt><strong>Error code</strong></dt> <dd>I/O; CHAR(*)<br> <p>The structure in which to return error information. For the format of the structure, see <a href="../apiref/error.htm#hdrerrcod">Error Code Parameter</a>. If this parameter is omitted, diagnostic and escape messages are issued to the application.</p> </dd> </dl> <br> <h3><a name="HDRTMPL1">SQLR0100 Format</a></h3> <p>The following table shows the format of the input template parameter for the SQLR0100 format. For detailed descriptions of the fields in the table, see <a href="#HDRTMPLFD">Field Descriptions</a>.</p> <table border width="80%"> <tr> <th align="center" valign="bottom" colspan="2">Offset</th> <th align="left" valign="bottom" rowspan="2">Type</th> <th align="left" valign="bottom" rowspan="2">Field</th> </tr> <tr> <th align="center" valign="bottom">Dec</th> <th align="center" valign="bottom">Hex</th> </tr> <tr> <td align="center" valign="top" width="10%">0</td> <td align="center" valign="top" width="10%">0</td> <td align="left" valign="top" width="20%">CHAR(258)</td> <td align="left" valign="top" width="60%">Database object name</td> </tr> <tr> <td align="center" valign="top">258</td> <td align="center" valign="top">102</td> <td align="left" valign="top">CHAR(258)</td> <td align="left" valign="top">Database object library name</td> </tr> <tr> <td align="center" valign="top">516</td> <td align="center" valign="top">204</td> <td align="left" valign="top">CHAR(10)</td> <td align="left" valign="top">Database object type</td> </tr> <tr> <td align="center" valign="top">526</td> <td align="center" valign="top">20E</td> <td align="left" valign="top">CHAR(10)</td> <td align="left" valign="top">Database source file name</td> </tr> <tr> <td align="center" valign="top">536</td> <td align="center" valign="top">218</td> <td align="left" valign="top">CHAR(10)</td> <td align="left" valign="top">Database source file library name</td> </tr> <tr> <td align="center" valign="top">546</td> <td align="center" valign="top">222</td> <td align="left" valign="top">CHAR(10)</td> <td align="left" valign="top">Database source file member name</td> </tr> <tr> <td align="center" valign="top">556</td> <td align="center" valign="top">22C</td> <td align="left" valign="top">BINARY(4)</td> <td align="left" valign="top">Severity level</td> </tr> <tr> <td align="center" valign="top">560</td> <td align="center" valign="top">230</td> <td align="left" valign="top">CHAR(1)</td> <td align="left" valign="top">Replace option</td> </tr> <tr> <td align="center" valign="top">561</td> <td align="center" valign="top">231</td> <td align="left" valign="top">CHAR(1)</td> <td align="left" valign="top">Statement formatting option</td> </tr> <tr> <td align="center" valign="top">562</td> <td align="center" valign="top">232</td> <td align="left" valign="top">CHAR(3)</td> <td align="left" valign="top">Date format</td> </tr> <tr> <td align="center" valign="top">565</td> <td align="center" valign="top">235</td> <td align="left" valign="top">CHAR(1)</td> <td align="left" valign="top">Date separator</td> </tr> <tr> <td align="center" valign="top">566</td> <td align="center" valign="top">236</td> <td align="left" valign="top">CHAR(3)</td> <td align="left" valign="top">Time format</td> </tr> <tr> <td align="center" valign="top">569</td> <td align="center" valign="top">239</td> <td align="left" valign="top">CHAR(1)</td> <td align="left" valign="top">Time separator</td> </tr> <tr> <td align="center" valign="top">570</td> <td align="center" valign="top">23A</td> <td align="left" valign="top">CHAR(3)</td> <td align="left" valign="top">Naming option</td> </tr> <tr> <td align="center" valign="top">573</td> <td align="center" valign="top">23D</td> <td align="left" valign="top">CHAR(1)</td> <td align="left" valign="top">Decimal point</td> </tr> <tr> <td align="center" valign="top">574</td> <td align="center" valign="top">23E</td> <td align="left" valign="top">CHAR(1)</td> <td align="left" valign="top">Standards option</td> </tr> <tr> <td align="center" valign="top">575</td> <td align="center" valign="top">23F</td> <td align="left" valign="top">CHAR(1)</td> <td align="left" valign="top">Drop option</td> </tr> <tr> <td align="center" valign="top">576</td> <td align="center" valign="top">240</td> <td align="left" valign="top">BINARY(4)</td> <td align="left" valign="top">Message level</td> </tr> <tr> <td align="center" valign="top">580</td> <td align="center" valign="top">244</td> <td align="left" valign="top">CHAR(1)</td> <td align="left" valign="top">Comment option</td> </tr> <tr> <td align="center" valign="top">581</td> <td align="center" valign="top">245</td> <td align="left" valign="top">CHAR(1)</td> <td align="left" valign="top">Label option</td> </tr> <tr> <td align="center" valign="top">582</td> <td align="center" valign="top">246</td> <td align="left" valign="top">CHAR(1)</td> <td align="left" valign="top">Header option</td> </tr> <tr> <td align="center" valign="top"><img src="delta.gif" alt="Start of change">583</td> <td align="center" valign="top">247</td> <td align="left" valign="top">CHAR(1)</td> <td align="left" valign="top">Trigger option<img src= "deltaend.gif" alt="End of change"></td> </tr> <tr> <td align="center" valign="top"><img src="delta.gif" alt="Start of change">584</td> <td align="center" valign="top">248</td> <td align="left" valign="top">CHAR(1)</td> <td align="left" valign="top">Constraint option<img src= "deltaend.gif" alt="End of change"></td> </tr> <tr> <td align="center" valign="top"><img src="delta.gif" alt="Start of change">585</td> <td align="center" valign="top">249</td> <td align="left" valign="top">CHAR(1)</td> <td align="left" valign="top">System name option<img src= "deltaend.gif" alt="End of change"></td> </tr> <tr> <td align="center" valign="top">586</td> <td align="center" valign="top">250</td> <td align="left" valign="top">CHAR(*)</td> <td align="left" valign="top">Reserved</td> </tr> </table> <br> <br> <h3><a name="HDRTMPLFD">Field Descriptions</a></h3> <p><strong>Comment option.</strong> The comment option specifies whether COMMENT ON SQL statements should be generated if a comment exists on the specified database object. If comments are not supported by the specified database object, the comment option is ignored. The valid values are:</p> <table width="100%"> <tr> <td align="left" valign="top" width="5%"><em>0</em></td> <td align="left" valign="top" width="95%">COMMENT ON SQL statements should not be generated.</td> </tr> <tr> <td align="left" valign="top"><em>1</em></td> <td align="left" valign="top">COMMENT ON SQL statements should be generated. If the specified database object type is a table or view, COMMENT ON SQL statements will also be generated for columns of the table or view.</td> </tr> </table> <p>If the Standards option is '2', comment option '1' is not valid.</p> <p><strong><img src="delta.gif" alt="Start of change">Constraint option.</strong> The constraint option specifies whether constraints should be generated when the object type is a TABLE. The valid values are:</p> <table width="100%"> <tr> <td align="left" valign="top" width="5%"><em>0</em></td> <td align="left" valign="top" width="95%">Constraints should not be generated.</td> </tr> <tr> <td align="left" valign="top"><em>1</em></td> <td align="left" valign="top" width="95%">Constraints should be generated.</td> </tr> </table> <p>The default is '1'.<img src="deltaend.gif" alt="End of change"></p> <p><strong>Database object name.</strong> The name of the database object for which DDL will be generated. Either the SQL name or the system name may be specified. The name is case sensitive. If delimiters are required for the name to be valid, they must be specified. For example, a file with a name of "abc" must be specified with the surrounding quotes. A file with a name of ABC must be specified in upper case.</p> <p>If the object type is a FUNCTION or PROCEDURE, this name must be the specific name of the function or procedure.</p> <p>If TABLE or VIEW is specified for the object type, the object name may identify an alias. In this case, the object that the alias points to will be generated. A CREATE ALIAS statement will be generated only if ALIAS is specified for the object type.</p> <p><strong>Database object library name.</strong> The name of the library containing the object for which DDL will be generated. The name is case sensitive. If delimiters are required for the name to be valid, they must be specified. This name is ignored if the specified object type is SCHEMA. You can use these special values for the library name:</p> <table width="100%"> <tr> <td width="10%" valign="top"><em>*CURLIB</em></td> <td width="90%" valign="top">The job's current library</td> </tr> <tr> <td align="left" valign="top"><em>*LIBL</em></td> <td align="left" valign="top">The library list</td> </tr> </table> <p><strong>Database object type.</strong> The type of the database object or object attribute for which DDL is generated. You can use these special values for the object type:</p> <table width="100%"> <tr> <td width="15%" valign="top"><em>ALIAS</em></td> <td width="85%" valign="top">The object is an SQL alias.<br> If the Standards option is '2', an ALIAS object type is not valid.</td> </tr> <tr> <td align="left" valign="top"><em>CONSTRAINT</em></td> <td align="left" valign="top">The object attribute is a constraint.</td> </tr> <tr> <td align="left" valign="top"><em>FUNCTION</em></td> <td align="left" valign="top">The object is an SQL function.</td> </tr> <tr> <td align="left" valign="top"><em>INDEX</em></td> <td align="left" valign="top">The object is an SQL index.<br> If the Standards option is '2', an INDEX object type is not valid.</td> </tr> <tr> <td align="left" valign="top"><em>PROCEDURE</em></td> <td align="left" valign="top">The object is an SQL procedure.</td> </tr> <tr> <td align="left" valign="top"><em>SCHEMA</em></td> <td align="left" valign="top">The object is an SQL schema (collection) or library.</td> </tr> <tr> <td align="left" valign="top"><em>TABLE</em></td> <td align="left" valign="top">The object is an SQL table or physical file.</td> </tr> <tr> <td align="left" valign="top"><em>TRIGGER</em></td> <td align="left" valign="top">The object attribute is a trigger.</td> </tr> <tr> <td align="left" valign="top"><em>TYPE</em></td> <td align="left" valign="top">The object is an SQL type.</td> </tr> <tr> <td align="left" valign="top"><em>VIEW</em></td> <td align="left" valign="top">The object is an SQL view or logical file.</td> </tr> </table> <p><strong>Database source file name.</strong> The name of the source file that contains the SQL statements generated by the API. The name must be a valid system name. The name is case sensitive. If delimiters are required for the name to be valid, they must be specified. For example, a file with a name of "abc" must be specified with the surrounding quotes. A file with a name of ABC must be specified in upper case.</p> <p>The record length of the specified source file must be greater than or equal to 92.</p> <p><strong>Database source file library name.</strong> The name of the library containing the source file that contains the SQL statements generated by the API. The name must be a valid system name. The name is case sensitive. If delimiters are required for the name to be valid, they must be specified. You can use these special values for the library name:</p> <table width="100%"> <tr> <td width="10%" align="left" valign="top"><em>*CURLIB</em></td> <td width="90%" align="left" valign="top">The job's current library</td> </tr> <tr> <td align="left" valign="top"><em>*LIBL</em></td> <td align="left" valign="top">The library list</td> </tr> </table> <p><strong>Database source file member name.</strong> The name of the source file member that contains the SQL statements generated by the API. The name must be a valid system name. The name is case sensitive. If delimiters are required for the name to be valid, they must be specified. You can use these special values for the member name.</p> <table width="100%"> <tr> <td width="10%" align="left" valign="top"><em>*FIRST</em></td> <td width="90%" align="left" valign="top">The first database physical file member found.</td> </tr> <tr> <td align="left" valign="top"><em>*LAST</em></td> <td align="left" valign="top">The last database physical file member found.</td> </tr> </table> <p><strong>Date format.</strong> The date format used for date constants in a generated SQL CREATE TABLE statement. The date format may not apply to date constants that are in ISO, EUR, USA, or JIS format in a CREATE VIEW, CREATE TRIGGER, CREATE FUNCTION, or CREATE PROCEDURE statement. The valid values are:</p> <table width="100%"> <tr> <td width="10%" align="left" valign="top"><em>ISO</em></td> <td width="90%" align="left" valign="top">International Standards Organization (yyyy-mm-dd)<br> <br> </td> </tr> <tr> <td align="left" valign="top"><em>EUR</em></td> <td align="left" valign="top">IBM European Standard (dd.mm.yyyy)<br> If the Standards option is '2', the EUR date format is not valid.<br> </td> </tr> <tr> <td align="left" valign="top"><em>JIS</em></td> <td align="left" valign="top">Japanese Industrial standard Christian Era (yyyy-mm-dd)<br> If the Standards option is '2', the JIS date format is not valid.</td> </tr> <tr> <td align="left" valign="top"><em>USA</em></td> <td align="left" valign="top">IBM USA standard (mm/dd/yyyy)<br> If the Standards option is '2', the USA date format is not valid.</td> </tr> <tr> <td align="left" valign="top"><em>MDY</em></td> <td align="left" valign="top">Month/day/year (mm/dd/yy)<br> If the Standards option is '1' or '2', the MDY date format is not valid.</td> </tr> <tr> <td align="left" valign="top"><em>DMY</em></td> <td align="left" valign="top">Day/month/year (dd/mm/yy)<br> If the Standards option is '1' or '2', the DMY date format is not valid.</td> </tr> <tr> <td align="left" valign="top"><em>YMD</em></td> <td align="left" valign="top">Year/month/day (yy/mm/dd)<br> If the Standards option is '1' or '2', the YMD date format is not valid.</td> </tr> <tr> <td align="left" valign="top"><em>JUL</em></td> <td align="left" valign="top">Julian (yy/ddd)<br> If the Standards option is '1' or '2', the JUL date format is not valid.</td> </tr> </table> <p><strong>Date separator.</strong> The date separator used for date constants in a generated SQL CREATE TABLE statement. The date separator may not apply to date constants that are in ISO, EUR, USA, or JIS format in a CREATE VIEW, CREATE TRIGGER, CREATE FUNCTION, or CREATE PROCEDURE statement. The date separator is only applicable if the date format is MDY, DMY, YMD, or JUL. The valid values are:</p> <table width="100%"> <tr> <td align="left" valign="top" width="5%"><em>/</em></td> <td align="left" valign="top" width="95%">Slash separator</td> </tr> <tr> <td align="left" valign="top"><em>.</em></td> <td align="left" valign="top">Period separator</td> </tr> <tr> <td align="left" valign="top"><em>,</em></td> <td align="left" valign="top">Comma separator</td> </tr> <tr> <td align="left" valign="top"><em>-</em></td> <td align="left" valign="top">Dash separator</td> </tr> <tr> <td align="left" valign="top"><em>blank</em></td> <td align="left" valign="top">Blank separator</td> </tr> </table> <p><strong>Decimal point.</strong> The decimal point used for numeric constants. The valid values are:</p> <table width="100%"> <tr> <td align="left" valign="top" width="5%"><em>.</em></td> <td align="left" valign="top" width="95%">Period separator</td> </tr> <tr> <td align="left" valign="top"><em>,</em></td> <td align="left" valign="top">Comma separator<br> If the Standards option is '1' or '2', the comma separator is not valid.</td> </tr> </table> <p><strong>Drop option.</strong> The drop option specifies whether DROP (or ALTER) SQL statements should be generated prior to the CREATE statement to drop the specified object. The valid values are:</p> <table width="100%"> <tr> <td align="left" valign="top" width="5%"><em>0</em></td> <td align="left" valign="top" width="95%">DROP statements should not be generated.</td> </tr> <tr> <td align="left" valign="top"><em>1</em></td> <td align="left" valign="top">DROP statements should be generated.<br> <p>Note that with the exception of DROP SCHEMA, the DROP statements generated will not include a CASCADE or RESTRICT option even if the standards option is '2'.</p> </td> </tr> </table> <p><strong>Header option.</strong> The header option specifies whether a header should be generated prior to the CREATE statement. The header consists of comments that describe the version, date and time, the relational database, and some of the options used to generate the SQL statements. The valid values are:</p> <table width="100%"> <tr> <td align="left" valign="top" width="5%"><em>0</em></td> <td align="left" valign="top" width="95%">A header should not be generated.</td> </tr> <tr> <td align="left" valign="top"><em>1</em></td> <td align="left" valign="top">A header should be generated.</td> </tr> </table> <p><strong>Label option.</strong> The label option specifies whether LABEL ON SQL statements should be generated if a label exists on the specified database object. If labels are not supported by the specified database object, the label option is ignored. The valid values are:</p> <table width="100%"> <tr> <td align="left" valign="top" width="5%"><em>0</em></td> <td align="left" valign="top" width="95%">LABEL ON SQL statements should not be generated.</td> </tr> <tr> <td align="left" valign="top"><em>1</em></td> <td align="left" valign="top">LABEL ON SQL statements should be generated. If the specified database object type is a table or view, LABEL ON SQL statements will also be generated for columns of the table or view.</td> </tr> </table> <p>If the Standards option is '1' or '2', label option '1' is not valid.</p> <p><strong>Message level.</strong> The severity level at which the messages are generated. If errors occur that have a severity level greater than this value, a message is generated in the output. The valid values are in the range 0 through 39 inclusive.</p> <p>The message level must be less than or equal to the severity level.</p> <p><strong>Naming option.</strong> The naming convention used for qualified names in the generated SQL statements. The valid values are:</p> <table width="100%"> <tr> <td width="10%" align="left" valign="top"><em>SQL</em></td> <td width="90%" align="left" valign="top"><em>collection.table</em> syntax</td> </tr> <tr> <td align="left" valign="top"><em>SYS</em></td> <td align="left" valign="top"><em>library/file</em> syntax<br> <p>If the Standards option is '1' or '2', the SYS naming option is not valid.</p> <p>If the object type is a FUNCTION, PROCEDURE, TRIGGER, or VIEW, and a column name is qualified by a qualified table name in the SQL body of the function, procedure, trigger, or view (that is, schema-name.table-name.column-name), the generated statement will not be valid because this type of column name qualification is not allowed in SYS naming.</p> </td> </tr> </table> <p><strong>Replace option.</strong> The replace option for the database source file member. The valid values are:</p> <table width="100%"> <tr> <td align="left" valign="top" width="5%"><em>0</em></td> <td align="left" valign="top" width="95%">The resulting SQL statements are appended to the end of the database source file member.</td> </tr> <tr> <td align="left" valign="top"><em>1</em></td> <td align="left" valign="top">The database source file member is cleared prior to adding the resulting SQL statements. If this option is chosen, the file may be cleared even if an error is returned from the API.</td> </tr> </table> <p><strong>Reserved.</strong> A reserved field. It must contain hexadecimal zeroes.</p> <p><strong>Severity level.</strong> The severity level at which the operation fails. If errors occur that have a severity level greater than this value, the operation ends. The valid values are in the range 0 through 39 inclusive. Any severity 40 error will cause the API to fail.</p> <table width="100%"> <tr> <td width="5%" valign="top"><em>0</em></td> <td width="95%" valign="top">No errors or warnings.</td> </tr> <tr> <td valign="top"><em>10</em></td> <td valign="top">The following attributes will result in messages with this severity level:<br> <ul> <li>Schema ASP and WITH DATA DICTIONARY <p>If the Standards option is 1 or 2, these clauses will be ignored.</p> </li> <li>Test libraries <p>A CREATE SCHEMA statement will be generated to create the schema. Schemas are production libraries.</p> </li> <li>Libraries with a CRTAUT parameter value <p>Under SQL naming, schemas are always created with CRTAUT(*EXCLUDE). Under SYS naming, schemas are always created with CRTAUT(*SYSVAL).</p> </li> <li>NODEGROUPs <p>If the Standards option is 1 or 2, the NODEGROUP clause will beignored.</p> </li> <li>LABEL ON TEXT <p>If the Standards option is 1, the text will be ignored.</p> </li> <li>COMMENT ON parameters <p>If the Standards option is 1, the comment will be ignored.</p> </li> <li>System file names <p>If the Standards option is 1 or 2, only the SQL names are generated. Otherwise, a RENAME statement is generated after the CREATE statement to assign the system name.</p> </li> <li>System column names <p>If the Standards option is 1 or 2, only the SQL names are generated. Otherwise, a FOR COLUMN clause will be generated to assign each system column name.</p> </li> <li>BIGINT data types <p>If the Standards option is 1 or 2, a DECIMAL(19,0) will be generated.</p> </li> <li>DBCS-open data types <p>If the Standards option is 1 or 2, a character field will be generated.</p> </li> <li style="list-style: none"> <ul> <li>Binary with non-zero scale <p>A decimal data type will be generated.</p> </li> <li>Files whose format name is different from the file name <p>The format name will be the same as the file name.</p> </li> <li>Files with a REUSEDLT(*NO) attribute <p>REUSEDLT(*YES) will be used.</p> </li> <li>Physical or logical files that use any of the following keywords: CHECK, CHKMSGID, CMP, DATFMT, EDTCDE, EDTWRD, TIMFMT, RANGE, REFSHIFT, VALUES <p>These keywords will be ignored.</p> </li> <li>Logical files that use any of the following keywords: CCSID or TRNTBL <p>These keywords will be ignored.</p> </li> <li>Join logical files with JDFTVAL or JDUPSEQ <p>A LEFT OUTER JOIN clause will be generated, but the join default value will be the null value and the JDUPSEQ keyword will be ignored.</p> </li> <li>Logical files with SST function <p>If the Standards option is 2, SUBSTRING is generated instead of SUBSTR.</p> </li> <li>COBOLLE and C++ languages in external functions and procedures <p>If the Standards option is 1 or 2, COBOL or C is generated.</p> </li> <li>RPGLE language in external functions and procedures <p>If the Standards option is 1, RPG is generated.</p> </li> </ul> </li> </ul> </td> </tr> </table> <br> <table width="100%"> <tr> <td width="5%" valign="top"><em>20</em></td> <td width="95%" valign="top">The following attributes will result in messages with this severity level:<br> <ul> <li>Multiple member files, files with no members, or files with MAXMBRS greater than one <p>The resulting file will contain one member.</p> </li> <li>Single format logical files with a member built over multiple physical file members <p>The resulting file will be based on the first physical file member.</p> </li> <li>Logical files that contain input/output fields that map an underlying physical file field to a different data type, length, precision or scale. <p>A CAST scalar function will be generated to map the data to the correct attributes, but the resulting column is input-only.</p> </li> <li>Keyed logical files that do not share the based on physical file's format, have more than one based on file, or have select/omit specifications <p>If INDEX is specified, the format and select/omit will be ignored.</p> </li> <li>Triggers with MODE DB2ROW <p>If the Standards option is 1 or 2, MODE DB2SQL will be used.</p> </li> </ul> </td> </tr> <tr> <td valign="top"><em>30</em></td> <td valign="top">The following attributes will result in messages with this severity level:<br> <ul> <li>CHAR or VARCHAR CCSID 65535 <p>If the Standards option is 2, a character field is generated.</p> </li> <li>GRAPHIC, VARGRAPHIC, or DBCLOB <p>If the Standards option is 2, a character field is generated.</p> </li> <li>DataLinks or Row IDs <p>If the Standards option is 1 or 2, a character field is generated.</p> </li> <li>Identity columns <p>If the Standards option is 2, the IDENTITY attribute is ignored.</p> </li> <li>Open, Only, or Either fields <p>If the Standards option is 0, the CCSID clause will result in an open field. Only and Either fields will result in a warning. If the Standards option is 1, FOR MIXED DATA is generated. If the Standards option is 2, character fields will be generated.</p> </li> <li>Keyed logical files <p>If VIEW is specified, the key specifications will be ignored, because all views are non-keyed.</p> </li> <li>Keyed physical files whose key is not a primary key <p>A CREATE TABLE will be generated without a primary key. The key specifications will be ignored, however, because only tables with a primary key are keyed.</p> </li> <li>Files that use any of the following keywords: ALTSEQ, DIGIT, FCFO, FIFO, LIFO, UNSIGNED, ZONE <p>These keywords will be ignored.</p> </li> <li>SRTSEQ <p>The sort sequence will be ignored.</p> </li> <li>Non-SQL triggers if TABLE object is specified. <p>The triggers will be ignored.</p> </li> <li>NO EXTERNAL ACTION, SCRATCHPAD, FINAL CALL, ALLOW PARALLEL, or DBINFO, keywords in functions and procedures <p>If the standards option is 2, these attributes will be ignored.</p> </li> <li>COMMIT ON RETURN YES, NOT FENCED, or NEW SAVEPOINT LEVEL clauses in functions and procedures <p>If the standards option is 1 or 2, these attributes will be ignored.</p> </li> <li>Functions and procedures with parameter style GENERAL WITH NULLS, DB2SQL, or DB2GENERAL <p>If the Standards option is 2, PARAMETER STYLE SQL is used.</p> </li> <li>JAVA, REXX, RPG, and RPGLE language in functions and procedures <p>If the Standards option is 2, the C language is used instead.</p> </li> <li>CL language in functions and procedures <p>If the Standards option is 1 or 2, the C language is used instead.</p> </li> </ul> </td> </tr> <tr> <td valign="top"><em>40</em></td> <td valign="top">The following attributes will result in messages with this severity level:<br> <ul> <li>Physical file if either VIEW or INDEX object type is specified.</li> <li>Logical file if TABLE object type is specified.</li> <li>Non-keyed file if INDEX object type is specified.</li> <li>Non-alias file if ALIAS object type is specified.</li> <li>Function if PROCEDURE object type is specified.</li> <li>Procedure if FUNCTION object type is specified.</li> <li>Device files</li> <li>Program described physical files</li> <li>Multiple format logical files</li> <li>Indexes if the Standards option is 2.</li> <li>Aliases if the Standards option is 2.</li> <li>EVI Indexes if the Standards option is 1.</li> <li>UNIQUE WHERE NOT NULL if the Standards option is 1.</li> <li>Aliases that contain a member name if the Standards option is 1.</li> <li>System-generated UDFs</li> <li>Built-in data types</li> <li>SQL UDFs, if the Standards option is 1.</li> <li>Sourced UDFs, if the Standards option is 2.</li> <li>User-defined table functions, if the Standards option is 2.</li> <li>Non-SQL triggers if TRIGGER object is specified.</li> </ul> </td> </tr> </table> <p><strong>Standards option.</strong> The standards option specifies whether the generated SQL statements should contain DB2 UDB for iSeries extensions or whether the statements should conform to the DB2 Universal Database Family SQL or to the ANS and ISO SQL standards. The valid values are:</p> <table width="100%"> <tr> <td width="5%" valign="top"><em>0</em></td> <td width="95%" valign="top">DB2 Universal Database for iSeries extensions may be generated in SQL statements.</td> </tr> <tr> <td valign="top"><em>1</em></td> <td valign="top">The generated SQL statements must conform to SQL statements common to the DB2 Universal Database Family.</td> </tr> <tr> <td valign="top"><em>2</em></td> <td valign="top">The generated SQL statements must conform to the following ANSI and ISO SQL standards:<br> <ul> <li>ISO (International Standards Organization) 9075-1: 1999, Database Language SQL</li> <li>ANSI (American National Standards Institute) X3.135-1-1999, Database Language SQL</li> </ul> </td> </tr> </table> <p>If option 1 or 2 is chosen, the SQL statements generated may not completely represent the object in DB2 UDB for iSeries; however, the statements will be compatible with the specified DB2 Family or ANSI and ISO standards option.</p> <p>If the object is an SQL function, SQL procedure, SQL trigger, or SQL view, the SQL statements in the body of the object are included in the generated SQL statement. Hence, if the option 1 or 2 is chosen, the generated SQL statement may not conform to the specified standards option since the statements within the body of the SQL object may not conform to the specified standard. For example, if a CREATE INDEX statement exists in the body of an SQL procedure, the generated CREATE PROCEDURE statement will contain the CREATE INDEX statement even if option 1 or 2 is chosen.</p> <p>There is no attempt to take product specific limits into account. For example, a table name in DB2 UDB for iSeries can be 128 bytes, but other products may not support table names that are that long. Thus, even if the generated SQL statement is standard, it still may not work on other products if they have smaller limits that those on DB2 Universal Database for iSeries.</p> <p>If option 1 is specified,</p> <ul> <li>The naming option must be SQL.</li> <li>The date format must be ISO, USA, EUR, or JIS.</li> <li>The time format must be ISO, USA, EUR, or JIS.</li> <li>The decimal point must be the period.</li> </ul> <p>If option 2 is specified,</p> <ul> <li>The naming option must be SQL.</li> <li>The date format must be ISO.</li> <li>The time format must be ISO.</li> <li>The decimal point must be the period.</li> <li>An ALIAS object type must not be specified.</li> </ul> <p><strong>Statement formatting option.</strong> The formatting option used in the generated SQL statements. The valid values are:</p> <table width="100%"> <tr> <td width="5%" valign="top"><em>0</em></td> <td width="95%" valign="top">No additional formatting characters are added to the generated SQL statements.</td> </tr> <tr> <td valign="top"><em>1</em></td> <td valign="top">Additional end-of-line characters and tab characters are added to the generated SQL statements.</td> </tr> <tr> <td valign="top"></td> <td valign="top"></td> </tr> </table> <p><strong><img src="delta.gif" alt="Start of change"></strong><strong>System name option.</strong> The system name option specifies whether a RENAME statement should be generated for the system name when it is different from the SQL name and the object type is an INDEX, TABLE, or VIEW. The valid values are:</p> <table width="100%"> <tr> <td align="left" valign="top" width="5%"><em>0</em></td> <td align="left" valign="top" width="95%">A RENAME statement should not be generated.</td> </tr> <tr> <td align="left" valign="top"><em>1</em></td> <td align="left" valign="top" width="95%">A RENAME statement should be generated.</td> </tr> </table> <p>If the Standards option is '1' or '2', system name option '1' is not valid. The default is '0'.<img src="deltaend.gif" alt="End of change"> </p> <p><strong>Time format.</strong> The format used for time constants in a generated SQL CREATE TABLE statement. The time format may not apply to date constants that are in ISO, EUR, USA, or JIS format in a CREATE VIEW, CREATE TRIGGER, CREATE FUNCTION, or CREATE PROCEDURE statement. in the generated SQL statements. The valid values are:</p> <table width="100%"> <tr> <td width="10%" valign="top"><em>ISO</em></td> <td width="90%" valign="top">International Standards Organization (hh.mm.ss)</td> </tr> <tr> <td valign="top"><em>EUR</em></td> <td valign="top">IBM European Standard (hh.mm.ss)</td> </tr> <tr> <td valign="top"></td> <td valign="top">If the Standards option is '2', the EUR time format is not valid.</td> </tr> <tr> <td valign="top"><em>JIS</em></td> <td valign="top">Japanese Industrial standard Christian Era (hh:mm:ss)</td> </tr> <tr> <td valign="top"></td> <td valign="top">If the Standards option is '2', the JIS time format is not valid.</td> </tr> <tr> <td valign="top"><em>USA</em></td> <td valign="top">IBM USA standard (hh:mm AM, hh:mm PM)</td> </tr> <tr> <td valign="top"></td> <td valign="top">If the Standards option is '2', the USA time format is not valid.</td> </tr> <tr> <td valign="top"><em>HMS</em></td> <td valign="top">Hour/minute/second (hh:mm:ss)</td> </tr> <tr> <td valign="top"></td> <td valign="top">If the Standards option is '1' or '2', the HMS time format is not valid.</td> </tr> </table> <br> <p><strong>Time separator.</strong> The time separator used for time constants in a generated SQL CREATE TABLE statement. The time separator may not apply to date constants that are in ISO, EUR, USA, or JIS format in a CREATE VIEW, CREATE TRIGGER, CREATE FUNCTION, or CREATE PROCEDURE statement. The time separator is only applicable if the time format is HMS. in the generated SQL statements. The valid values are:</p> <table width="100%"> <tr> <td width="5%" valign="top"><em>:</em></td> <td width="95%" valign="top">Colon separator</td> </tr> <tr> <td valign="top"><em>.</em></td> <td valign="top">Period separator</td> </tr> <tr> <td valign="top"><em>,</em></td> <td valign="top">Comma separator</td> </tr> <tr> <td valign="top"><em>blank</em></td> <td valign="top">Blank separator</td> </tr> </table> <br> <p><strong><img src="delta.gif" alt="Start of change">Trigger option.</strong> The trigger option specifies whether triggers should be generated when the object type is a TABLE or VIEW. The valid values are:</p> <table width="100%"> <tr> <td align="left" valign="top" width="5%"><em>0</em></td> <td align="left" valign="top" width="95%">Triggers should not be generated.</td> </tr> <tr> <td align="left" valign="top"><em>1</em></td> <td align="left" valign="top" width="95%">Triggers should be generated.</td> </tr> </table> <p>The default is '1'.<img src="deltaend.gif" alt="End of change"> <br></p> <h3>Usage Notes</h3> <p>If the value of the statement formatting option is 0, the generated SQL statements will be minimally formatted by adding blanks. For example:</p> <pre> CREATE TABLE mjatst.table_one ( column_one INTEGER, column_two INTEGER, column_three CHAR(4000)); </pre> <p>If the value of the statement formatting option is 1, the generated SQL statements will be formatted by inserting end-of-line characters, tab characters, and spaces. For example:</p> <pre> CREATE TABLE mjatst.table_one ( column_one INTEGER, column_two INTEGER, column_three CHAR(4000)); </pre> <br> <h3>Error Messages</h3> <table width="86%"> <tr> <th align="left" valign="top" width="21%">Message ID</th> <th align="left" valign="top" width="79%">Error Message Text</th> </tr> <tr> <td width="21%" valign="top">CPF24B4 E</td> <td width="79%" valign="top">Severe error while addressing parameter list.</td> </tr> <tr> <td valign="top" width="21%" height="22">CPF3C21 E</td> <td valign="top" width="79%" height="22">Format name &1 is not valid.</td> </tr> <tr> <td valign="top" width="21%" height="24">CPF3C23</td> <td valign="top" width="79%" height="24">Object &1 is not a file of the correct type.</td> </tr> <tr> <td valign="top" width="21%" height="24">CPF3C26 </td> <td valign="top" width="79%" height="24">File &1 has no members.</td> </tr> <tr> <td valign="top" width="21%">CPF3C39 E</td> <td valign="top" width="79%">Value for reserved field not valid.</td> </tr> <tr> <td valign="top" width="21%">CPF3C3A E</td> <td valign="top" width="79%">Value for parameter &2 for API &1 not valid.</td> </tr> <tr> <td valign="top" width="21%">CPF3C90 E</td> <td valign="top" width="79%">Literal value cannot be changed.</td> </tr> <tr> <td valign="top" width="21%">CPF3CF1 E</td> <td valign="top" width="79%">Error code parameter not valid.</td> </tr> <tr> <td valign="top" width="21%">CPF8100 E</td> <td valign="top" width="79%">All CPF81xx messages could be returned. xx is from 01 to FF.</td> </tr> <tr> <td valign="top" width="21%">CPF9800 E</td> <td valign="top" width="79%">All CPF98xx messages could be signaled. xx is from 01 to FF.</td> </tr> <tr> <td valign="top" width="21%" height="24">SQL0113</td> <td valign="top" width="79%" height="24">Name &1 not allowed.</td> </tr> <tr> <td valign="top" width="21%" height="25">SQL7001</td> <td valign="top" width="79%" height="25">File &1 in &2 not database file. </td> </tr> <tr> <td valign="top" width="21%">SQL7003</td> <td valign="top" width="79%">File &1 in &2 has more than one format.</td> </tr> <tr> <td valign="top" width="21%">SQL7011</td> <td valign="top" width="79%">&1 in &2 not table, view, or physical file.</td> </tr> <tr> <td valign="top" width="21%" height="24">SQL7039</td> <td valign="top" width="79%" height="24">QSQGNDDL API input template field values not compatible.</td> </tr> <tr> <td valign="top" width="21%">SQL7040 </td> <td valign="top" width="79%">Message severity &1 exceeds specified severity level &2. </td> </tr> <tr> <td valign="top" width="21%">SQL7041 </td> <td valign="top" width="79%">&1 in &2 not valid for object type &3. </td> </tr> <tr> <td valign="top" width="21%">SQL7042 </td> <td valign="top" width="79%">Value not valid for QSQGNDDL API input template. </td> </tr> <tr> <td valign="top" width="21%" height="25">SQL7043 </td> <td valign="top" width="79%" height="25">System-generated function or built-in data type &1 in &2 not allowed.</td> </tr> <tr> <td valign="top" width="21%">SQL7044 </td> <td valign="top" width="79%">&3 not supported by the standards option for &1 in &2.</td> </tr> <tr> <td valign="top" width="21%">SQL7045 </td> <td valign="top" width="79%">Function &1 in &2 not allowed.</td> </tr> <tr> <td valign="top" width="21%">SQL7046 </td> <td valign="top" width="79%">Generate SQL for &1 in &2 object type &3 failed.</td> </tr> <tr> <td valign="top" width="21%">SQL7047 </td> <td valign="top" width="79%">System trigger &1 in &2 not allowed.</td> </tr> </table> <br> <hr> API introduced: V5R1 <hr> <center> <table cellpadding="2" cellspacing="2"> <tr align="center"> <td valign="middle" align="center"><a href="#Top_Of_Page">Top</a> | <a href= "file1.htm">Database and File APIs</a> | <a href="aplist.htm">APIs by category</a></td> </tr> </table> </center> <br> </body> </html>