Command reference / db
RUNSQLSTM
Run SQL Statements
Processes a source file of SQL statements. Statements run in the default activation group. If RUNSQLSTM is included in a compiled CL program or ILE CL procedure, the activation group of that program or procedure is ignored.
Allowed environments: *ALL.
Positional parameters: 4.
Parameters
SRCFILE
Source file
Source file containing the SQL statements to run. It can be a database file or an inline data file. The second qualifier is the library.
*LIBL- All libraries in the thread's library list are searched until the first match.
*CURLIB- The job's current library is searched; QGPL is used if no current library is set.
Qualified parts (object, then library; write LIBRARY/OBJECT)
Source file
Source file
Library
Library
Suggested / special values:
*LIBL, *CURLIB
SRCMBR
Source member
Source file member that contains the SQL statements to run.
SRCSTMF
Source stream file
Path name of the file that contains the SQL statements. The path may be absolute or relative.
COMMIT
Commitment control
Whether SQL statements run under commitment control.
Allowed values:
*CHG, *UR, *CS, *ALL, *RS, *NONE, *NC, *RR
*CHG- Referenced objects and changed rows are locked until end of unit of work; uncommitted changes in other jobs can be seen.
*CS- Locks as for *CHG, and selected-but-not-updated rows are locked until the next row is selected; uncommitted changes in other jobs cannot be seen.
*ALL- Referenced objects and selected, updated, deleted and inserted rows are locked until end of unit of work; uncommitted changes in other jobs cannot be seen.
*NONE- Commitment control is not used; uncommitted changes in other jobs can be seen. Required if the SQL DROP SCHEMA statement is included.
*RR- As *ALL, and tables used by SELECT, UPDATE, DELETE and INSERT are locked exclusively until end of unit of work; uncommitted changes in other jobs cannot be seen.
NAMING
Naming
Naming convention used for objects in SQL statements.
Allowed values:
*SYS, *SQL
*SYS- The system naming convention (library/file) is used.
*SQL- The SQL naming convention (schema.table) is used.
ERRLVL
Severity level
Severity level, 0 through 40 (default 10). If errors above this level occur, no more statements run and they are rolled back under commitment control; syntax checking continues for remaining statements.
DATFMT
Date format
Allowed values:
*JOB, *USA, *ISO, *EUR, *JIS, *MDY, *DMY, *YMD, *JUL
DATSEP
Date separator character
Allowed values:
/, ., ,, -, , *JOB, *BLANK
TIMFMT
Time format
Allowed values:
*HMS, *USA, *ISO, *EUR, *JIS
TIMSEP
Time separator character
Allowed values:
:, ., ,, , *JOB, *BLANK
MARGINS
Source margins
Elements in order
Right margin
Right margin
DFTRDBCOL
Default collection
Suggested / special values:
*NONE
SAAFLAG
IBM SQL flagging
Allowed values:
*NOFLAG, *FLAG
FLAGSTD
ANS flagging
Allowed values:
*NONE, *ANS
DECMPT
Decimal point
Allowed values:
*JOB, *SYSVAL, *PERIOD, *COMMA
SRTSEQ
Sort sequence
Qualified parts (object, then library; write LIBRARY/OBJECT)
Sort sequence
Sort sequence
Library
Library
Suggested / special values:
*LIBL, *CURLIB
LANGID
Language id
Suggested / special values:
*JOB
OPTION
Source listing options
Allowed values:
*LIST, *NOSRC, *ERRLIST, *NOLIST
PRTFILE
Print file
Printer device file that receives the output. It must have a record length of at least 132 bytes.
*LIBL- Qualifier 2: all libraries in the library list are searched.
*CURLIB- Qualifier 2: the current library is searched; QGPL if none is set.
Qualified parts (object, then library; write LIBRARY/OBJECT)
Print file
Print file
Library
Library
Suggested / special values:
*LIBL, *CURLIB
PROCESS
Statement processing
Whether SQL statements are run or only syntax-checked.
Allowed values:
*RUN, *SYN
*RUN- Statements are syntax-checked and run.
*SYN- Statements are syntax-checked only.
SECLVLTXT
Second level text
Allowed values:
*NO, *YES
ALWCPYDTA
Allow copy of data
Allowed values:
*OPTIMIZE, *YES, *NO
ALWBLK
Allow blocking
Allowed values:
*ALLREAD, *NONE, *READ
SQLCURRULE
SQL rules
Allowed values:
*DB2, *STD
DECRESULT
Decimal result options
Elements in order
Maximum precision
Maximum precision
Allowed values:
31
Maximum scale
Maximum scale
Minimum divide scale
Minimum divide scale
CONACC
Concurrent access resolution
Allowed values:
*DFT, *CURCMT, *WAIT
SYSTIME
System time sensitive
Allowed values:
*YES, *NO
OUTPUT
Listing output
Allowed values:
*NONE, *ERROR, *NOLIST, *MSG, *PRINT
TGTRLS
Target release
Suggested / special values:
*CURRENT
DBGVIEW
Debugging view
Allowed values:
*NONE, *SOURCE, *STMT, *LIST
CLOSQLCSR
Close SQL cursor
Allowed values:
*ENDMOD, *ENDACTGRP
DLYPRP
Delay PREPARE
Allowed values:
*NO, *YES
USRPRF
User profile
Allowed values:
*NAMING, *USER, *OWNER
DYNUSRPRF
Dynamic user profile
Allowed values:
*USER, *OWNER
Examples
RUNSQLSTM SRCFILE(MYLIB/MYFILE) SRCMBR(MYMBR)
Processes the SQL statements in member MYMBR of file MYFILE in library MYLIB.
Generated from os/cl/catalog/RUNSQLSTM.json and os/cl/help/RUNSQLSTM.json.