Command reference / db

STRSQL

Start SQL Interactive Session

Starts the interactive SQL program. It immediately shows the Enter SQL Statements display, where you can build, edit, enter and run an SQL statement interactively. Messages raised while the program runs are shown on that display. Allowed only in interactive environments (*INTERACT, *IPGM, *IREXX, *EXEC).

The source help entry is marked incomplete.

Allowed environments: *INTERACT, *IPGM, *IREXX, *EXEC. Positional parameters: 6.

Parameters

COMMIT Commitment control

Specifies whether SQL statements run under commitment control. Positional 1.

Type
*CHAR
Required
No
Default
*NONE
Length
5
Case
Uppercase

Allowed values: *NONE, *CHG, *CS, *ALL, *RR, *NC, *UR, *RS

*NONE
No commitment control. Uncommitted changes in other jobs can be seen. If SQL DROP SCHEMA is used, *NONE or *NC must be specified.
*NC
Same as *NONE.
*CHG
Rows updated, deleted and inserted, and the objects in certain DDL and GRANT/REVOKE statements, are locked until the end of the unit of work. Uncommitted changes in other jobs can be seen.
*UR
Same as *CHG.
*CS
Like *CHG, except rows that are selected but not updated are locked only until the next row is selected. Uncommitted changes in other jobs cannot be seen.
*ALL
Rows selected, updated, deleted and inserted are locked until the end of the unit of work. Uncommitted changes in other jobs cannot be seen.
*RS
Same as *ALL.
*RR
Like *ALL, and all tables referred to in SELECT, UPDATE, DELETE and INSERT statements are locked exclusively until the end of the unit of work.

NAMING Naming convention

Specifies the naming convention for objects in SQL statements. Positional 2.

Type
*CHAR
Required
No
Default
*SYS
Length
4
Case
Uppercase

Allowed values: *SYS, *SQL

*SYS
The system naming convention (library-name/file-name) is used.
*SQL
The SQL naming convention (schema-name.table-name) is used.

PROCESS Statement processing

Specifies which processing steps are applied to the statements. Positional 3.

Type
*CHAR
Required
No
Default
*RUN
Length
4
Case
Uppercase

Allowed values: *RUN, *VLD, *SYN

*RUN
Statements are syntax checked, data checked, and then run.
*VLD
Statements are syntax checked and data checked, but not run.
*SYN
Statements are syntax checked only.

LIBOPT Library option

Specifies the libraries shown when list support is requested from the Enter SQL Statements display (F4, F16, F17, F18). Libraries without *EXECUTE authority are not shown. Positional 4.

Type
*NAME
Required
No
Default
*LIBL
Length
10
Case
Uppercase

Suggested / special values: *LIBL, *USRLIBL, *ALLUSR, *ALL, *CURLIB

*LIBL
All libraries in the job's library list are searched until the first match is found.
*USRLIBL
Only libraries in the user portion of the job's library list are shown.
*ALL
All libraries on the system, including QSYS, are shown.
*ALLUSR
All user libraries are shown, including the Qxxx libraries that IBM supplies and that hold frequently changing user data.
*CURLIB
The job's current library is shown.

LISTTYPE List type

Specifies which object types are displayed when list support is requested from the Enter SQL Statements display or a prompt. Positional 5.

Type
*CHAR
Required
No
Default
*ALL
Length
4
Case
Uppercase

Allowed values: *ALL, *SQL

*ALL
All objects are displayed.
*SQL
Only SQL-created objects are displayed.

REFRESH Data refresh

Specifies when the displayed select output is refreshed. Positional 6.

Type
*CHAR
Required
No
Default
*ALWAYS
Length
8
Case
Uppercase

Allowed values: *ALWAYS, *FORWARD

*ALWAYS
Data is always refreshed. Cannot be combined with ALWCPYDTA(*OPTIMIZE).
*FORWARD
Data is refreshed only the first time the user pages forward to the end of the data.

ALWCPYDTA Allow copy data

Specifies whether a copy of the data can be used when running a SELECT statement.

Type
*CHAR
Required
No
Default
*YES
Length
9
Case
Uppercase

Allowed values: *YES, *OPTIMIZE, *NO

*YES
A copy of the data is used only if necessary to run a SELECT statement.
*OPTIMIZE
The system chooses between the data read directly from the database and a copy, based on performance.
*NO
A copy is not allowed. If the SELECT clauses require one, an error is returned.

DATFMT Date format

Specifies the format used for date result columns and for validating input date strings.

Type
*CHAR
Required
No
Default
*JOB
Length
4
Case
Uppercase

Allowed values: *JOB, *USA, *ISO, *EUR, *JIS, *MDY, *DMY, *YMD, *JUL

*JOB
The format set for the job at precompile time, or when the interactive SQL session is created, is used.
*USA
mm/dd/yyyy format.
*ISO
yyyy-mm-dd format.
*EUR
dd.mm.yyyy format.
*JIS
yyyy-mm-dd format.
*MDY
mm/dd/yy format.
*DMY
dd/mm/yy format.
*YMD
yy/mm/dd format.
*JUL
Julian yy/ddd format.

DATSEP Date separator character

Type
*CHAR
Required
No
Default
*JOB
Length
6
Case
Uppercase

Allowed values: /, ., ,, -, , *JOB, *BLANK

TIMFMT Time format

Type
*CHAR
Required
No
Default
*HMS
Length
4
Case
Uppercase

Allowed values: *HMS, *USA, *ISO, *EUR, *JIS

TIMSEP Time separator character

Type
*CHAR
Required
No
Default
*JOB
Length
6
Case
Uppercase

Allowed values: :, ., ,, , *JOB, *BLANK

DECPNT Decimal point

Type
*CHAR
Required
No
Default
*JOB
Length
7
Case
Uppercase

Allowed values: *JOB, *PERIOD, *COMMA, *SYSVAL

SRTSEQ Sort sequence

Type
*QUAL
Required
No
Case
Uppercase
Qualified parts (object, then library; write LIBRARY/OBJECT)

Sort sequence Sort sequence

Type
*NAME
Required
No
Length
10
Case
Uppercase

Library Library

Type
*NAME
Required
No
Default
*LIBL
Length
10
Case
Uppercase

Suggested / special values: *LIBL, *CURLIB

LANGID Language identifier

Type
*CHAR
Required
No
Default
*JOB
Length
50
Case
Uppercase

Suggested / special values: *JOB, *JOBRUN

PGMLNG Program language

Type
*CHAR
Required
No
Default
*NONE
Length
5
Case
Uppercase

Allowed values: *NONE, *C, *CBL, *PLI, *RPG, *FTN

SQLSTRDLM SQL string delimiter

Type
*CHAR
Required
No
Default
*QUOTESQL
Length
9
Case
Uppercase

Allowed values: *QUOTESQL, *APOSTSQL

IBM command documentation

Generated from os/cl/catalog/STRSQL.json and os/cl/help/STRSQL.json.