ibm-information-center/dist/eclipse/plugins/i5OS.ic.cl_5.4.0.1/runsqlstm.htm

973 lines
38 KiB
HTML
Raw Normal View History

2024-04-02 14:02:31 +00:00
<!doctype html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head><META http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Run SQL Statements (RUNSQLSTM)</title>
<link rel="stylesheet" type="text/css" href="../rzahg/ic.css">
</head>
<body bgcolor="white">
<script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
<a name="RUNSQLSTM.Top_Of_Page"></a>
<h2>Run SQL Statements (RUNSQLSTM)</h2>
<table width="100%">
<tr>
<td valign="top" align="left"><b>Where allowed to run: </b>All environments (*ALL)<br>
<b>Threadsafe: </b>No
</td>
<td valign="top" align="right">
<a href="#RUNSQLSTM.PARAMETERS.TABLE">Parameters</a><br>
<a href="#RUNSQLSTM.COMMAND.EXAMPLES">Examples</a><br>
<a href="#RUNSQLSTM.ERROR.MESSAGES">Error messages</a></td>
</tr>
</table>
<div> <a name="RUNSQLSTM"></a>
<p>The Run SQL Statements (RUNSQLSTM) command processes a source file of Structure Query Language (SQL) statements.
</p>
</div>
<table width="100%">
<tr><td align="right"><a href="#RUNSQLSTM.Top_Of_Page">Top</a></td></tr>
</table>
<hr size="2" width="100%">
<div>
<h3><a name="RUNSQLSTM.PARAMETERS.TABLE">Parameters</a></h3>
<table border="1" cellpadding="4" cellspacing="0">
<!-- col1="10" col2="15" col3="30" col4="10" -->
<tr>
<th bgcolor="aqua" valign="bottom" align="left">Keyword</th>
<th bgcolor="aqua" valign="bottom" align="left">Description</th>
<th bgcolor="aqua" valign="bottom" align="left">Choices</th>
<th bgcolor="aqua" valign="bottom" align="left">Notes</th>
</tr>
<tr>
<td valign="top" rowspan="3"><a href="#RUNSQLSTM.SRCFILE"><b>SRCFILE</b></a></td>
<td valign="top">Source file</td>
<td valign="top"><i>Qualified object name</i></td>
<td valign="top" rowspan="3">Required, Positional 1</td>
</tr>
<tr>
<td valign="top">Qualifier 1: Source file</td>
<td valign="top"><i>Name</i></td>
</tr><tr>
<td valign="top">Qualifier 2: Library</td>
<td valign="top"><i>Name</i>, <b><u>*LIBL</u></b>, *CURLIB</td>
</tr><tr>
<td valign="top"><a href="#RUNSQLSTM.SRCMBR"><b>SRCMBR</b></a></td>
<td valign="top">Source member</td>
<td valign="top"><i>Name</i></td>
<td valign="top">Required, Positional 2</td>
</tr>
<tr>
<td valign="top"><a href="#RUNSQLSTM.COMMIT"><b>COMMIT</b></a></td>
<td valign="top">Commitment control</td>
<td valign="top"><b><u>*CHG</u></b>, *UR, *CS, *ALL, *RS, *NONE, *NC, *RR</td>
<td valign="top">Optional, Positional 3</td>
</tr>
<tr>
<td valign="top"><a href="#RUNSQLSTM.NAMING"><b>NAMING</b></a></td>
<td valign="top">Naming</td>
<td valign="top"><b><u>*SYS</u></b>, *SQL</td>
<td valign="top">Optional, Positional 4</td>
</tr>
<tr>
<td valign="top"><a href="#RUNSQLSTM.ERRLVL"><b>ERRLVL</b></a></td>
<td valign="top">Severity level</td>
<td valign="top">0-40, <b><u>10</u></b></td>
<td valign="top">Optional</td>
</tr>
<tr>
<td valign="top"><a href="#RUNSQLSTM.DATFMT"><b>DATFMT</b></a></td>
<td valign="top">Date format</td>
<td valign="top"><b><u>*JOB</u></b>, *USA, *ISO, *EUR, *JIS, *MDY, *DMY, *YMD, *JUL</td>
<td valign="top">Optional</td>
</tr>
<tr>
<td valign="top"><a href="#RUNSQLSTM.DATSEP"><b>DATSEP</b></a></td>
<td valign="top">Date separator character</td>
<td valign="top"><b><u>*JOB</u></b>, '/', '.', ',', '-', '&nbsp;', *BLANK</td>
<td valign="top">Optional</td>
</tr>
<tr>
<td valign="top"><a href="#RUNSQLSTM.TIMFMT"><b>TIMFMT</b></a></td>
<td valign="top">Time format</td>
<td valign="top"><b><u>*HMS</u></b>, *USA, *ISO, *EUR, *JIS</td>
<td valign="top">Optional</td>
</tr>
<tr>
<td valign="top"><a href="#RUNSQLSTM.TIMSEP"><b>TIMSEP</b></a></td>
<td valign="top">Time separator character</td>
<td valign="top"><b><u>*JOB</u></b>, ':', '.', ',', '&nbsp;', *BLANK</td>
<td valign="top">Optional</td>
</tr>
<tr>
<td valign="top"><a href="#RUNSQLSTM.DFTRDBCOL"><b>DFTRDBCOL</b></a></td>
<td valign="top">Default collection</td>
<td valign="top"><i>Name</i>, <b><u>*NONE</u></b></td>
<td valign="top">Optional</td>
</tr>
<tr>
<td valign="top"><a href="#RUNSQLSTM.SAAFLAG"><b>SAAFLAG</b></a></td>
<td valign="top">IBM SQL flagging</td>
<td valign="top"><b><u>*NOFLAG</u></b>, *FLAG</td>
<td valign="top">Optional</td>
</tr>
<tr>
<td valign="top"><a href="#RUNSQLSTM.FLAGSTD"><b>FLAGSTD</b></a></td>
<td valign="top">ANS flagging</td>
<td valign="top"><b><u>*NONE</u></b>, *ANS</td>
<td valign="top">Optional</td>
</tr>
<tr>
<td valign="top"><a href="#RUNSQLSTM.DECMPT"><b>DECMPT</b></a></td>
<td valign="top">Decimal Point</td>
<td valign="top"><b><u>*JOB</u></b>, *SYSVAL, *PERIOD, *COMMA</td>
<td valign="top">Optional</td>
</tr>
<tr>
<td valign="top" rowspan="3"><a href="#RUNSQLSTM.SRTSEQ"><b>SRTSEQ</b></a></td>
<td valign="top">Sort sequence</td>
<td valign="top">Single values: <b><u>*JOB</u></b>, *LANGIDUNQ, *LANGIDSHR, *HEX<br>Other values: <i>Qualified object name</i></td>
<td valign="top" rowspan="3">Optional</td>
</tr>
<tr>
<td valign="top">Qualifier 1: Sort sequence</td>
<td valign="top"><i>Name</i></td>
</tr><tr>
<td valign="top">Qualifier 2: Library</td>
<td valign="top"><i>Name</i>, <b><u>*LIBL</u></b>, *CURLIB</td>
</tr><tr>
<td valign="top"><a href="#RUNSQLSTM.LANGID"><b>LANGID</b></a></td>
<td valign="top">Language id</td>
<td valign="top"><i>Character value</i>, <b><u>*JOB</u></b></td>
<td valign="top">Optional</td>
</tr>
<tr>
<td valign="top" rowspan="3"><a href="#RUNSQLSTM.PRTFILE"><b>PRTFILE</b></a></td>
<td valign="top">Print file</td>
<td valign="top"><i>Qualified object name</i></td>
<td valign="top" rowspan="3">Optional</td>
</tr>
<tr>
<td valign="top">Qualifier 1: Print file</td>
<td valign="top"><i>Name</i>, <b><u>QSYSPRT</u></b></td>
</tr><tr>
<td valign="top">Qualifier 2: Library</td>
<td valign="top"><i>Name</i>, <b><u>*LIBL</u></b>, *CURLIB</td>
</tr><tr>
<td valign="top"><a href="#RUNSQLSTM.PROCESS"><b>PROCESS</b></a></td>
<td valign="top">Statement processing</td>
<td valign="top"><b><u>*RUN</u></b>, *SYN</td>
<td valign="top">Optional</td>
</tr>
<tr>
<td valign="top"><a href="#RUNSQLSTM.ALWCPYDTA"><b>ALWCPYDTA</b></a></td>
<td valign="top">Allow copy of data</td>
<td valign="top"><b><u>*OPTIMIZE</u></b>, *YES, *NO</td>
<td valign="top">Optional</td>
</tr>
<tr>
<td valign="top"><a href="#RUNSQLSTM.ALWBLK"><b>ALWBLK</b></a></td>
<td valign="top">Allow blocking</td>
<td valign="top"><b><u>*ALLREAD</u></b>, *NONE, *READ</td>
<td valign="top">Optional</td>
</tr>
<tr>
<td valign="top"><a href="#RUNSQLSTM.SQLCURRULE"><b>SQLCURRULE</b></a></td>
<td valign="top">SQL rules</td>
<td valign="top"><b><u>*DB2</u></b>, *STD</td>
<td valign="top">Optional</td>
</tr>
<tr>
<td valign="top" rowspan="4"><a href="#RUNSQLSTM.DECRESULT"><b>DECRESULT</b></a></td>
<td valign="top">Decimal result options</td>
<td valign="top"><i>Element list</i></td>
<td valign="top" rowspan="4">Optional</td>
</tr>
<tr>
<td valign="top">Element 1: Maximum precision</td>
<td valign="top">
<b><u>31</u></b>, 63</td>
</tr>
<tr>
<td valign="top">Element 2: Maximum scale</td>
<td valign="top">
0-63, <b><u>31</u></b></td>
</tr>
<tr>
<td valign="top">Element 3: Minimum divide scale</td>
<td valign="top">
0-9, <b><u>0</u></b></td>
</tr>
<tr>
<td valign="top"><a href="#RUNSQLSTM.OUTPUT"><b>OUTPUT</b></a></td>
<td valign="top">Listing output</td>
<td valign="top"><b><u>*NONE</u></b>, *PRINT</td>
<td valign="top">Optional</td>
</tr>
<tr>
<td valign="top"><a href="#RUNSQLSTM.TGTRLS"><b>TGTRLS</b></a></td>
<td valign="top">Target release</td>
<td valign="top"><i>Simple name</i>, <b><u>*CURRENT</u></b></td>
<td valign="top">Optional</td>
</tr>
<tr>
<td valign="top"><a href="#RUNSQLSTM.DBGVIEW"><b>DBGVIEW</b></a></td>
<td valign="top">Debugging view</td>
<td valign="top"><b><u>*NONE</u></b>, *SOURCE, *STMT, *LIST</td>
<td valign="top">Optional</td>
</tr>
<tr>
<td valign="top"><a href="#RUNSQLSTM.CLOSQLCSR"><b>CLOSQLCSR</b></a></td>
<td valign="top">Close SQL cursor</td>
<td valign="top"><b><u>*ENDACTGRP</u></b>, *ENDMOD</td>
<td valign="top">Optional</td>
</tr>
<tr>
<td valign="top"><a href="#RUNSQLSTM.DLYPRP"><b>DLYPRP</b></a></td>
<td valign="top">Delay PREPARE</td>
<td valign="top"><b><u>*NO</u></b>, *YES</td>
<td valign="top">Optional</td>
</tr>
<tr>
<td valign="top"><a href="#RUNSQLSTM.USRPRF"><b>USRPRF</b></a></td>
<td valign="top">User profile</td>
<td valign="top"><b><u>*NAMING</u></b>, *USER, *OWNER</td>
<td valign="top">Optional</td>
</tr>
<tr>
<td valign="top"><a href="#RUNSQLSTM.DYNUSRPRF"><b>DYNUSRPRF</b></a></td>
<td valign="top">Dynamic user profile</td>
<td valign="top"><b><u>*USER</u></b>, *OWNER</td>
<td valign="top">Optional</td>
</tr>
</table>
<table width="100%">
<tr><td align="right"><a href="#RUNSQLSTM.Top_Of_Page">Top</a></td></tr>
</table>
</div>
<div> <a name="RUNSQLSTM.SRCFILE"></a>
<h3>Source file (SRCFILE)</h3>
<p>Specifies the source file that contains the Structured Query Language (SQL) statements to be run.
</p>
<p><b>Qualifier 1: Run SQL Statements</b>
</p>
<dl>
<dt><b><i>name</i></b></dt>
<dd>Specify the name of the source file that contains the SQL statements to be run. The source file can be a database file or an inline data file.
</dd>
</dl>
<p><b>Qualifier 2: Library</b>
</p>
<dl>
<dt><b><u>*LIBL</u></b></dt>
<dd>All libraries in the library list for the current thread are searched until the first match is found.
</dd>
</dl>
<dl>
<dt><b>*CURLIB</b></dt>
<dd>The current library for the job is searched. If no library is specified as the current library for the job, the QGPL library is used.
</dd>
<dt><b><i>name</i></b></dt>
<dd>Specify the name of the library to be searched.
</dd>
</dl>
</div>
<table width="100%">
<tr><td align="right"><a href="#RUNSQLSTM.Top_Of_Page">Top</a></td></tr>
</table>
<div> <a name="RUNSQLSTM.SRCMBR"></a>
<h3>Source member (SRCMBR)</h3>
<p>Specifies the source file member that contains the Structured Query Language (SQL) statements to be run.
</p>
<dl>
<dt><b><i>name</i></b></dt>
<dd>Specify the name of the source file member that contains the SQL statements to be run.
</dd>
</dl>
</div>
<table width="100%">
<tr><td align="right"><a href="#RUNSQLSTM.Top_Of_Page">Top</a></td></tr>
</table>
<div> <a name="RUNSQLSTM.COMMIT"></a>
<h3>Commitment control (COMMIT)</h3>
<p>Specifies whether SQL statements are run under commitment control.
</p>
<dl>
<dt><b><u>*CHG</u> <i>or</i> <u>*UR</u></b></dt>
<dd>Specifies the objects referred to in SQL ALTER, CALL, COMMENT ON, CREATE, DROP, GRANT, LABEL ON, RENAME, and REVOKE statements and the rows updated, deleted, and inserted are locked until the end of the unit of work (transaction). Uncommitted changes in other jobs can be seen.
</dd>
<dt><b>*CS</b></dt>
<dd>Specifies the objects referred to in SQL ALTER, CALL, COMMENT ON, CREATE, DROP, GRANT, LABEL ON, RENAME, and REVOKE statements and the rows updated, deleted, and inserted are locked until the end of the unit of work (transaction). A row that is selected, but not updated, is locked until the next row is selected. Uncommitted changes in other jobs cannot be seen.
</dd>
<dt><b>*ALL <i>or</i> *RS</b></dt>
<dd>Specifies the objects referred to in SQL ALTER, CALL, COMMENT ON, CREATE, DROP, GRANT, LABEL ON, RENAME, and REVOKE statements and the rows selected, updated, deleted, and inserted are locked until the end of the unit of work (transaction). Uncommitted changes in other jobs cannot be seen.
</dd>
<dt><b>*NONE <i>or</i> *NC</b></dt>
<dd>Specifies that commitment control is not used. Uncommitted changes in other jobs can be seen. If the SQL DROP SCHEMA statement is included in the program, *NONE or *NC must be used.
</dd>
<dt><b>*RR</b></dt>
<dd>Specifies the objects referred to in SQL ALTER, CALL, COMMENT ON, CREATE, DROP, GRANT, LABEL ON, RENAME, and REVOKE statements and the rows selected, updated, deleted, and inserted are locked until the end of the unit of work (transaction). Uncommitted changes in other jobs cannot be seen. All tables referred to in SELECT, UPDATE, DELETE, and INSERT statements are locked exclusively until the end of the unit of work (transaction).
</dd>
</dl>
</div>
<table width="100%">
<tr><td align="right"><a href="#RUNSQLSTM.Top_Of_Page">Top</a></td></tr>
</table>
<div> <a name="RUNSQLSTM.NAMING"></a>
<h3>Naming convention (NAMING)</h3>
<p>Specifies the naming convention used for objects in SQL statements.
</p>
<dl>
<dt><b><u>*SYS</u></b></dt>
<dd>The system naming convention (library-name/file-name) is used.
</dd>
<dt><b>*SQL</b></dt>
<dd>The SQL naming convention (schema-name.table-name) is used.
</dd>
</dl>
</div>
<table width="100%">
<tr><td align="right"><a href="#RUNSQLSTM.Top_Of_Page">Top</a></td></tr>
</table>
<div> <a name="RUNSQLSTM.ERRLVL"></a>
<h3>Severity level (ERRLVL)</h3>
<p>Specifies whether the processing is successful, based on the severity of the messages generated by the processing of the SQL statements. If errors that are greater than the value specified for this parameter occur during processing, no more statements are processed and the statements are rolled back if they are running under commitment control.
</p>
<dl>
<dt><b><u>10</u></b></dt>
<dd>Statement processing is stopped when error messages with a severity level greater than 10 are received.
</dd>
<dt><b><i>0-40</i></b></dt>
<dd>Specify the severity level to be used.
</dd>
</dl>
</div>
<table width="100%">
<tr><td align="right"><a href="#RUNSQLSTM.Top_Of_Page">Top</a></td></tr>
</table>
<div> <a name="RUNSQLSTM.DATFMT"></a>
<h3>Date format (DATFMT)</h3>
<p>Specifies the format used when accessing date result columns. For input date strings, the specified value is used to determine whether the date is specified in a valid format.
</p>
<p>
<b>Note: </b>An input date string that uses the format *USA, *ISO, *EUR, or *JIS is always valid.
</p>
<dl>
<dt><b><u>*JOB</u></b></dt>
<dd>The format specified for the job is used. Use the Display Job (DSPJOB) command to determine the current date format for the job.
</dd>
<dt><b>*USA</b></dt>
<dd>The United States date format <b>mm/dd/yyyy</b> is used.
</dd>
<dt><b>*ISO</b></dt>
<dd>The International Organization for Standardization (ISO) date format <b>yyyy-mm-dd</b> is used.
</dd>
<dt><b>*EUR</b></dt>
<dd>The European date format <b>dd.mm.yyyy</b> is used.
</dd>
<dt><b>*JIS</b></dt>
<dd>The Japanese Industrial Standard date format <b>yyyy-mm-dd</b> is used.
</dd>
<dt><b>*MDY</b></dt>
<dd>The date format <b>mm/dd/yy</b> is used.
</dd>
<dt><b>*DMY</b></dt>
<dd>The date format <b>dd/mm/yy</b> is used.
</dd>
<dt><b>*YMD</b></dt>
<dd>The date format <b>yy/mm/dd</b> is used.
</dd>
<dt><b>*JUL</b></dt>
<dd>The Julian date format <b>yy/ddd</b> is used.
</dd>
</dl>
</div>
<table width="100%">
<tr><td align="right"><a href="#RUNSQLSTM.Top_Of_Page">Top</a></td></tr>
</table>
<div> <a name="RUNSQLSTM.DATSEP"></a>
<h3>Date separator character (DATSEP)</h3>
<p>Specifies the separator used when accessing date result columns.
</p>
<p>
<b>Note: </b>This parameter applies only when *JOB, *MDY, *DMY, *YMD, or *JUL is specified for the <b>Date format (DATFMT)</b> parameter.
</p>
<dl>
<dt><b><u>*JOB</u></b></dt>
<dd>The date separator specified for the job at precompile time, when a new interactive SQL session is created, or when RUNSQLSTM is run is used.
<p>Use the Display Job (DSPJOB) command to determine the current date separator value for the job.
</p>
</dd>
<dt><b>'/'</b></dt>
<dd>A slash is used as the date separator.
</dd>
<dt><b>'.'</b></dt>
<dd>A period is used as the date separator.
</dd>
<dt><b>'-'</b></dt>
<dd>A dash is used as the date separator.
</dd>
<dt><b>','</b></dt>
<dd>A comma is used as the date separator.
</dd>
<dt><b>' ' <i>or</i> *BLANK</b></dt>
<dd>A blank is used as the date separator.
</dd>
</dl>
</div>
<table width="100%">
<tr><td align="right"><a href="#RUNSQLSTM.Top_Of_Page">Top</a></td></tr>
</table>
<div> <a name="RUNSQLSTM.TIMFMT"></a>
<h3>Time format (TIMFMT)</h3>
<p>Specifies the format used when accessing time result columns. For input time strings, the specified value is used to determine whether the time is specified in a valid format.
</p>
<p>
<b>Note: </b>An input time string that uses the format *USA, *ISO, *EUR, or *JIS is always valid.
</p>
<dl>
<dt><b><u>*HMS</u></b></dt>
<dd>The <b>hh:mm:ss</b> format is used.
</dd>
<dt><b>*USA</b></dt>
<dd>The United States time format <b>hh:mmxx</b> is used, where <b>xx</b> is AM or PM.
</dd>
<dt><b>*ISO</b></dt>
<dd>The International Organization for Standardization (ISO) time format <b>hh.mm.ss</b> is used.
</dd>
<dt><b>*EUR</b></dt>
<dd>The European time format <b>hh.mm.ss</b> is used.
</dd>
<dt><b>*JIS</b></dt>
<dd>The Japanese Industrial Standard time format <b>hh:mm:ss</b> is used.
</dd>
</dl>
</div>
<table width="100%">
<tr><td align="right"><a href="#RUNSQLSTM.Top_Of_Page">Top</a></td></tr>
</table>
<div> <a name="RUNSQLSTM.TIMSEP"></a>
<h3>Time separator character (TIMSEP)</h3>
<p>Specifies the separator used when accessing time result columns.
</p>
<p>
<b>Note: </b>This parameter applies only when *HMS is specified for the <b>Time format (TIMFMT)</b> parameter.
</p>
<dl>
<dt><b><u>*JOB</u></b></dt>
<dd>The time separator specified for the job at precompile time, when a new interactive SQL session is created, or when RUNSQLSTM is run is used.
<p>Use the Display Job (DSPJOB) command to determine the current time separator value for the job.
</p>
</dd>
<dt><b>':'</b></dt>
<dd>A colon is used as the time separator.
</dd>
<dt><b>'.'</b></dt>
<dd>A period is used as the time separator.
</dd>
<dt><b>','</b></dt>
<dd>A comma is used as the time separator.
</dd>
<dt><b>' ' <i>or</i> *BLANK</b></dt>
<dd>A blank is used as the time separator.
</dd>
</dl>
</div>
<table width="100%">
<tr><td align="right"><a href="#RUNSQLSTM.Top_Of_Page">Top</a></td></tr>
</table>
<div> <a name="RUNSQLSTM.DFTRDBCOL"></a>
<h3>Default collection (DFTRDBCOL)</h3>
<p>Specifies the name of the schema identifier used for the unqualified names of the tables, views, indexes, SQL packages, aliases, constraints, external programs, node groups, and triggers. This parameter applies only to static SQL statements.
</p>
<dl>
<dt><b><u>*NONE</u></b></dt>
<dd>The naming convention specified for the <b>Naming convention (NAMING)</b> parameter is used.
</dd>
<dt><b><i>name</i></b></dt>
<dd>Specify the name of the schema identifier to be used instead of the naming convention specified for the NAMING parameter.
</dd>
</dl>
</div>
<table width="100%">
<tr><td align="right"><a href="#RUNSQLSTM.Top_Of_Page">Top</a></td></tr>
</table>
<div> <a name="RUNSQLSTM.SAAFLAG"></a>
<h3>IBM SQL flagging (SAAFLAG)</h3>
<p>Specifies the IBM SQL flagging function. This parameter allows you to flag SQL statements to verify whether they conform to IBM SQL syntax.
</p>
<dl>
<dt><b><u>*NOFLAG</u></b></dt>
<dd>No checks are made to see whether SQL statements conform to IBM SQL syntax.
</dd>
<dt><b>*FLAG</b></dt>
<dd>Checks are made to see whether SQL statements conform to IBM SQL syntax.
</dd>
</dl>
</div>
<table width="100%">
<tr><td align="right"><a href="#RUNSQLSTM.Top_Of_Page">Top</a></td></tr>
</table>
<div> <a name="RUNSQLSTM.FLAGSTD"></a>
<h3>ANS flagging (FLAGSTD)</h3>
<p>Specifies whether non-standard statements are flagged. This parameter allows you to flag SQL statements to verify whether they conform to the Core level of the ISO/IEC 9075-2003 standards.
</p>
<dl>
<dt><b><u>*NONE</u></b></dt>
<dd>No checks are made to see whether SQL statements conform to ANSI standards.
</dd>
<dt><b>*ANS</b></dt>
<dd>Checks are made to see whether SQL statements conform to standards.
</dd>
</dl>
</div>
<table width="100%">
<tr><td align="right"><a href="#RUNSQLSTM.Top_Of_Page">Top</a></td></tr>
</table>
<div> <a name="RUNSQLSTM.DECMPT"></a>
<h3>Decimal Point (DECMPT)</h3>
<p>Specifies the decimal point value used for numeric constants in SQL statements. This value is also used as the decimal point character when casting between character and numeric values.
</p>
<dl>
<dt><b><u>*JOB</u></b></dt>
<dd>The representation for the decimal point is the value used by the job running the statement.
</dd>
<dt><b>*SYSVAL</b></dt>
<dd>The QDECFMT system value is used as the decimal point.
</dd>
<dt><b>*PERIOD</b></dt>
<dd>A period represents the decimal point.
</dd>
<dt><b>*COMMA</b></dt>
<dd>A comma represents the decimal point.
</dd>
</dl>
</div>
<table width="100%">
<tr><td align="right"><a href="#RUNSQLSTM.Top_Of_Page">Top</a></td></tr>
</table>
<div> <a name="RUNSQLSTM.SRTSEQ"></a>
<h3>Sort sequence (SRTSEQ)</h3>
<p>Specifies the sort sequence table to be used for string comparisons in SQL statements.
</p>
<p><b>Single values</b>
</p>
<dl>
<dt><b><u>*JOB</u></b></dt>
<dd>The SRTSEQ value for the job is used.
</dd>
<dt><b>*LANGIDUNQ</b></dt>
<dd>The unique-weight sort table for the language specified for the <b>Language id (LANGID)</b> parameter is used.
</dd>
<dt><b>*LANGIDSHR</b></dt>
<dd>The shared-weight sort table for the language specified for the LANGID parameter is used.
</dd>
<dt><b>*HEX</b></dt>
<dd>A sort sequence table is not used. The hexadecimal values of the characters are used to determine the sort sequence.
</dd>
</dl>
<p><b>Qualifier 1: Sort sequence</b>
</p>
<dl>
<dt><b><i>name</i></b></dt>
<dd>Specify the name of the sort sequence table to be used with this program.
</dd>
</dl>
<p><b>Qualifier 2: Library</b>
</p>
<dl>
<dt><b><u>*LIBL</u></b></dt>
<dd>All libraries in the library list for the current thread are searched until the first match is found.
</dd>
</dl>
<dl>
<dt><b>*CURLIB</b></dt>
<dd>The current library for the job is searched. If no library is specified as the current library for the job, the QGPL library is used.
</dd>
<dt><b><i>name</i></b></dt>
<dd>Specify the name of the library to be searched.
</dd>
</dl>
</div>
<table width="100%">
<tr><td align="right"><a href="#RUNSQLSTM.Top_Of_Page">Top</a></td></tr>
</table>
<div> <a name="RUNSQLSTM.LANGID"></a>
<h3>Language id (LANGID)</h3>
<p>Specifies the language identifier to be used when SRTSEQ(*LANGIDUNQ) or SRTSEQ(*LANGIDSHR) is specified.
</p>
<dl>
<dt><b><u>*JOB</u></b></dt>
<dd>The LANGID value for the job is retrieved.
</dd>
<dt><b><i>language-identifier</i></b></dt>
<dd>Specify a language identifier.
</dd>
</dl>
</div>
<table width="100%">
<tr><td align="right"><a href="#RUNSQLSTM.Top_Of_Page">Top</a></td></tr>
</table>
<div> <a name="RUNSQLSTM.PRTFILE"></a>
<h3>Print file (PRTFILE)</h3>
<p>Specifies the printer device file to which the RUNSQLSTM printout is directed. The file must have a minimum length of 132 bytes. If a file with a record length of less than 132 bytes is specified, information is lost.
</p>
<p><b>Qualifier 1: Print file</b>
</p>
<dl>
<dt><b><u>QSYSPRT</u></b></dt>
<dd>The RUNSQLSTM output file is directed to the IBM-supplied printer file, QSYSPRT.
</dd>
<dt><b><i>name</i></b></dt>
<dd>Specify the name of the printer device file to which the RUNSQLSTM output is directed.
</dd>
</dl>
<p><b>Qualifier 2: Library</b>
</p>
<dl>
<dt><b><u>*LIBL</u></b></dt>
<dd>All libraries in the library list for the current thread are searched until the first match is found.
</dd>
</dl>
<dl>
<dt><b>*CURLIB</b></dt>
<dd>The current library for the job is searched. If no library is specified as the current library for the job, the QGPL library is used.
</dd>
<dt><b><i>name</i></b></dt>
<dd>Specify the name of the library where the printer file is located.
</dd>
</dl>
</div>
<table width="100%">
<tr><td align="right"><a href="#RUNSQLSTM.Top_Of_Page">Top</a></td></tr>
</table>
<div> <a name="RUNSQLSTM.PROCESS"></a>
<h3>Statement processing (PROCESS)</h3>
<p>Specifies whether SQL statements in the source file member are executed or syntax-checked only.
</p>
<dl>
<dt><b><u>*RUN</u></b></dt>
<dd>Statements are syntax-checked and run.
</dd>
<dt><b>*SYN</b></dt>
<dd>Statements are syntax-checked only.
</dd>
</dl>
</div>
<table width="100%">
<tr><td align="right"><a href="#RUNSQLSTM.Top_Of_Page">Top</a></td></tr>
</table>
<div> <a name="RUNSQLSTM.ALWCPYDTA"></a>
<h3>Allow copy of data (ALWCPYDTA)</h3>
<p>Specifies whether a copy of the data can be used in a SELECT statement.
</p>
<dl>
<dt><b><u>*OPTIMIZE</u></b></dt>
<dd>The system determines whether to use the data retrieved directly from the database or to use a copy of the data. The decision is based on which method provides the best performance. If the <b>Commitment control (COMMIT)</b> parameter is not *NONE, the <b>Allow blocking (ALWBLK)</b> parameter should be set to *ALLREAD, when possible, for best performance.
</dd>
<dt><b>*YES</b></dt>
<dd>A copy of the data is used only when necessary.
</dd>
<dt><b>*NO</b></dt>
<dd>A copy of the data is not used. If a temporary copy of the data is required to perform the query, an error message is returned.
</dd>
</dl>
</div>
<table width="100%">
<tr><td align="right"><a href="#RUNSQLSTM.Top_Of_Page">Top</a></td></tr>
</table>
<div> <a name="RUNSQLSTM.ALWBLK"></a>
<h3>Allow blocking (ALWBLK)</h3>
<p>Specifies whether the database manager can use record blocking and the extent to which blocking can be used for read-only cursors.
</p>
<dl>
<dt><b><u>*ALLREAD</u></b></dt>
<dd>Rows are blocked for read-only cursors. All cursors in a program that are not explicitly able to be changed are opened for read-only processing even though there may be EXECUTE or EXECUTE IMMEDIATE statements in the program.
<p>Specifying *ALLREAD:
</p>
<ul>
<li>Allows record blocking for all read-only cursors.
</li>
<li>Can improve the performance of almost all read-only cursors in programs, but limits queries in the following ways:
<ul>
<li>The Rollback (ROLLBACK) command, a ROLLBACK statement in host languages, or the ROLLBACK HOLD SQL statement does not reposition a read-only cursor when *ALLREAD is specified.
</li>
<li>Dynamic running of a positioned UPDATE or DELETE statement (for example, using EXECUTE IMMEDIATE), can not be used to update a row in a cursor unless the DECLARE statement for the cursor includes the FOR UPDATE clause.
</li>
</ul>
</li>
</ul>
</dd>
<dt><b>*NONE</b></dt>
<dd>Rows are not blocked for retrieval of data for cursors.
<p>Specifying *NONE:
</p>
<ul>
<li>Guarantees that the data retrieved is current.
</li>
<li>May reduce the amount of time required to retrieve the first row of data for a query.
</li>
<li>Stops the database manager from retrieving a block of data rows that is not used by the program when only the first few rows of a query are retrieved before the query is closed.
</li>
<li>Can degrade the overall performance of a query that retrieves a large number of rows.
</li>
</ul>
</dd>
<dt><b>*READ</b></dt>
<dd>Records are blocked for read-only retrieval of data for cursors when:
<ul>
<li>*NONE is specified for the <b>Commitment control (COMMIT)</b> parameter, which indicates that commitment control is not used.
</li>
<li>The cursor is declared with a FOR READ ONLY clause or there are no dynamic statements that could run a positioned UPDATE or DELETE statement for the cursor.
</li>
</ul>
</dd>
</dl>
</div>
<table width="100%">
<tr><td align="right"><a href="#RUNSQLSTM.Top_Of_Page">Top</a></td></tr>
</table>
<div> <a name="RUNSQLSTM.SQLCURRULE"></a>
<h3>SQL rules (SQLCURRULE)</h3>
<p>Specifies the semantics used for SQL statements.
</p>
<dl>
<dt><b><u>*DB2</u></b></dt>
<dd>The semantics of all SQL statements will default to the rules established for DB2. The following semantics are controlled by this option:
<p>Hexadecimal constants are treated as character data.
</p>
</dd>
<dt><b>*STD</b></dt>
<dd>The semantics of all SQL statements will default to the rules established by the ISO and ANSI SQL standards. The following semantics are controlled by this option:
<p>Hexadecimal constants are treated as binary data.
</p>
</dd>
</dl>
</div>
<table width="100%">
<tr><td align="right"><a href="#RUNSQLSTM.Top_Of_Page">Top</a></td></tr>
</table>
<div> <a name="RUNSQLSTM.DECRESULT"></a>
<h3>Decimal result options (DECRESULT)</h3>
<p>Specifies the maximum precision, maximum scale and minimum divide scale that should be returned for result data types. The specified limit only applies to numeric (zoned) and decimal (packed) data types used in arithmetic expressions and in SQL column functions AVG and SUM.
</p>
<p><b>Element 1: Maximum precision</b>
</p>
<dl>
<dt><b><u>31</u></b></dt>
<dd>The maximum precision (length) that should be returned for the result data types is 31 digits.
</dd>
<dt><b>63</b></dt>
<dd>The maximum precision (length) that should be returned for the result data types is 63 digits.
</dd>
</dl>
<p><b>Element 2: Maximum scale</b>
</p>
<dl>
<dt><b><u>31</u></b></dt>
<dd>The maximum scale (number of decimal positions to the right of the decimal point) that should be returned for the result data types is 31 digits.
</dd>
<dt><b><i>0-63</i></b></dt>
<dd>Specify the maximum scale (number of decimal positions to the right of the decimal point) that should be returned for the result data types. The value can range from 0 to the maximum precision.
</dd>
</dl>
<p><b>Element 3: Minimum divide scale</b>
</p>
<dl>
<dt><b><u>0</u></b></dt>
<dd>The minimum divide scale (number of decimal positions to the right of the decimal point) that should be returned for both intermediate and result data types is 0.
</dd>
<dt><b><i>0-9</i></b></dt>
<dd>Specify the minimum divide scale (number of decimal positions to the right of the decimal point) that should be returned for both intermediate and result data types. The value cannot exceed the maximum scale. If 0 is specified for the maximum scale, minimum divide scale is not used.
</dd>
</dl>
</div>
<table width="100%">
<tr><td align="right"><a href="#RUNSQLSTM.Top_Of_Page">Top</a></td></tr>
</table>
<div> <a name="RUNSQLSTM.OUTPUT"></a>
<h3>Listing output (OUTPUT)</h3>
<p>Specifies whether the precompiler listing is generated.
</p>
<p>
<b>Note: </b>This parameter applies only to CREATE statements for SQL procedures, functions, or triggers in the source file. This value will be used when creating the program for the SQL routine.
</p>
<dl>
<dt><b><u>*NONE</u></b></dt>
<dd>The precompiler listing is not generated.
</dd>
<dt><b>*PRINT</b></dt>
<dd>The precompiler listing is generated.
</dd>
</dl>
</div>
<table width="100%">
<tr><td align="right"><a href="#RUNSQLSTM.Top_Of_Page">Top</a></td></tr>
</table>
<div> <a name="RUNSQLSTM.TGTRLS"></a>
<h3>Target release (TGTRLS)</h3>
<p>Specifies the release of the operating system on which you intend to use the object being created.
</p>
<p>
<b>Note: </b>This parameter applies only to CREATE statements for SQL procedures, functions, or triggers in the source file. This value will be used when creating the program for the SQL routine.
</p>
<p>When specifying the <b>target-release</b> value, the format VxRxMx is used to specify the release, where Vx is the version, Rx is the release, and Mx is the modification level. For example, V5R3M0 is version 5, release 3, modification 0.
</p>
<p>Valid values depend on the current version, release, and modification level of the operating system, and they change with each new release.
</p>
<dl>
<dt><b><u>*CURRENT</u></b></dt>
<dd>The object is to be used on the release of the operating system currently running on your system. The object can also be used on a system with any subsequent release of the operating system installed.
</dd>
<dt><b><i>target-release</i></b></dt>
<dd>Specify the release in the format VxRxMx. The object can be used on a system with the specified release or with any subsequent release of the operating system installed.
</dd>
</dl>
</div>
<table width="100%">
<tr><td align="right"><a href="#RUNSQLSTM.Top_Of_Page">Top</a></td></tr>
</table>
<div> <a name="RUNSQLSTM.DBGVIEW"></a>
<h3>Debugging view (DBGVIEW)</h3>
<p>Specifies the type of source debug information to be provided by SQL.
</p>
<p>
<b>Note: </b>This parameter applies only to CREATE statements for SQL procedures, functions, or triggers in the source file. This value will be used when creating the program for the SQL routine.
</p>
<dl>
<dt><b><u>*NONE</u></b></dt>
<dd>No debug view information is generated.
</dd>
<dt><b>*SOURCE</b></dt>
<dd>Generates a source view of the C source generated by RUNSQLSTM for the SQL procedures, functions, or triggers in the input SQL source member. The C source member is passed to the SQL precompiler by invoking the CRTSQLCI (Create SQL ILE C object) command. A source view is also generated by the SQL precompiler for the C source member which is produced by the precompiler.
</dd>
<dt><b>*STMT</b></dt>
<dd>Allows the compiled object to be debugged using program statement numbers and symbolic identifiers.
</dd>
<dt><b>*LIST</b></dt>
<dd>Generates the listing view for debugging the compiled object.
</dd>
</dl>
</div>
<table width="100%">
<tr><td align="right"><a href="#RUNSQLSTM.Top_Of_Page">Top</a></td></tr>
</table>
<div> <a name="RUNSQLSTM.CLOSQLCSR"></a>
<h3>Close SQL cursor (CLOSQLCSR)</h3>
<p>Specifies when SQL cursors are implicitly closed, SQL prepared statements are implicitly discarded, and LOCK TABLE locks are released. SQL cursors are explicitly closed when the user issues the CLOSE, COMMIT, or ROLLBACK (without HOLD) SQL statements.
</p>
<p>
<b>Note: </b>This parameter applies only to CREATE statements for SQL procedures, functions, or triggers in the source file. This value will be used when creating the program for the SQL routine.
</p>
<dl>
<dt><b><u>*ENDACTGRP</u></b></dt>
<dd>SQL cursors are closed and SQL prepared statements are implicitly discarded, and LOCK TABLE locks are released when the activation group ends.
</dd>
<dt><b>*ENDMOD</b></dt>
<dd>SQL cursors are closed and SQL prepared statements are implicitly discarded when the module is exited. LOCK TABLE locks are released when the first SQL program on the call stack ends.
</dd>
</dl>
</div>
<table width="100%">
<tr><td align="right"><a href="#RUNSQLSTM.Top_Of_Page">Top</a></td></tr>
</table>
<div> <a name="RUNSQLSTM.DLYPRP"></a>
<h3>Delay PREPARE (DLYPRP)</h3>
<p>Specifies whether the dynamic statement validation for a PREPARE statement is delayed until an OPEN, EXECUTE, or DESCRIBE statement is run. Delaying validation improves performance by eliminating redundant validation.
</p>
<p>
<b>Note: </b>This parameter applies only to CREATE statements for SQL procedures, functions, or triggers in the source file. This value will be used when creating the program for the SQL routine.
</p>
<dl>
<dt><b><u>*NO</u></b></dt>
<dd>Dynamic statement validation is not delayed. When the dynamic statement is prepared, the access plan is validated. When the dynamic statement is used in an OPEN or EXECUTE statement, the access plan is revalidated. Because the authority or the existence of objects referred to by the dynamic statement may change, you must still check the SQLCODE or SQLSTATE after issuing the OPEN or EXECUTE statement to ensure that the dynamic statement is still valid.
</dd>
<dt><b>*YES</b></dt>
<dd>Dynamic statement validation is delayed until the dynamic statement is used in an OPEN, EXECUTE, or DESCRIBE SQL statement. When the dynamic statement is used, the validation is completed and an access plan is built. If you specify *YES on this parameter for precompiled programs, you should check the SQLCODE and SQLSTATE after running an OPEN, EXECUTE, or DESCRIBE statement to ensure that the dynamic statement is valid.
<p>
<b>Note: </b>If you specify *YES, performance is not improved if the INTO clause is used on the PREPARE statement or if a DESCRIBE statement uses the dynamic statement before an OPEN is issued for the statement.
</p>
</dd>
</dl>
</div>
<table width="100%">
<tr><td align="right"><a href="#RUNSQLSTM.Top_Of_Page">Top</a></td></tr>
</table>
<div> <a name="RUNSQLSTM.USRPRF"></a>
<h3>User profile (USRPRF)</h3>
<p>Specifies the user profile that is used when the compiled program object and SQL package object is run, including the authority that the program object or SQL package has for each object in static SQL statements. The profile of either the owner or the user is used to control access to objects.
</p>
<p>
<b>Note: </b>This parameter applies only to CREATE statements for SQL procedures, functions, or triggers in the source file. This value will be used when creating the program for the SQL routine.
</p>
<dl>
<dt><b><u>*NAMING</u></b></dt>
<dd>The user profile is determined by the naming convention. If the naming convention is *SQL, USRPRF(*OWNER) is used. If the naming convention is *SYS, USRPRF(*USER) is used.
</dd>
<dt><b>*USER</b></dt>
<dd>The profile of the user running the program or SQL package is used.
</dd>
<dt><b>*OWNER</b></dt>
<dd>The user profiles of both the owner and the user are used when the program or SQL package is run.
</dd>
</dl>
</div>
<table width="100%">
<tr><td align="right"><a href="#RUNSQLSTM.Top_Of_Page">Top</a></td></tr>
</table>
<div> <a name="RUNSQLSTM.DYNUSRPRF"></a>
<h3>Dynamic user profile (DYNUSRPRF)</h3>
<p>Specifies the user profile used for dynamic SQL statements.
</p>
<p>
<b>Note: </b>This parameter applies only to CREATE statements for SQL procedures, functions, or triggers in the source file. This value will be used when creating the program for the SQL routine.
</p>
<dl>
<dt><b><u>*USER</u></b></dt>
<dd>Local dynamic SQL statements are run under the profile of the program's user. Distributed dynamic SQL statements are run under the profile of the application server job.
</dd>
<dt><b>*OWNER</b></dt>
<dd>Local dynamic SQL statements are run under the profile of the program's owner. Distributed dynamic SQL statements are run under the profile of the SQL package's owner.
</dd>
</dl>
</div>
<table width="100%">
<tr><td align="right"><a href="#RUNSQLSTM.Top_Of_Page">Top</a></td></tr>
</table>
<hr size="2" width="100%">
<div><h3><a name="RUNSQLSTM.COMMAND.EXAMPLES">Examples</a> </h3>
<p>
<pre>
RUNSQLSTM SRCFILE(MYLIB/MYFILE) SRCMBR(MYMBR)
</pre>
</p>
<p>This command processes the SQL statements in member MYMBR found in file MYFILE in library MYLIB.
</p>
</div>
<table width="100%">
<tr><td align="right"><a href="#RUNSQLSTM.Top_Of_Page">Top</a></td></tr>
</table>
<hr size="2" width="100%">
<div><h3><a name="RUNSQLSTM.ERROR.MESSAGES">Error messages</a> </h3>
<p><b><u>*ESCAPE Messages</u></b>
</p>
<dl>
<dt><b>SQL9006</b></dt>
<dd>DB2 UDB Query Manager and SQL Development Kit for iSeries not at same install level as i5/OS.
</dd>
<dt><b>SQL9010</b></dt>
<dd>RUNSQLSTM command failed.
</dd>
<dt><b>SQL9014</b></dt>
<dd>Remote Connection Active
</dd>
</dl>
</div>
<table width="100%">
<tr><td align="right"><a href="#RUNSQLSTM.Top_Of_Page">Top</a></td></tr>
</table>
</body>
</html>