Learn it on Mainframe Path. Do it with Mainframe KIT.Learn on Mainframe Path ▸
Mainframe KIT ● Nothing leaves this tab

Db2 SQL explainer

Paste a SQL statement and read it in plain English: order of evaluation, host variables and the SQLCODEs to expect.Use this when you want to understand an embedded or plain Db2 SQL statement: what order it runs in, which host variables go in or out, and which SQLCODEs to expect.

Simulation, confirm on z/OSON THIS DEVICE · NOTHING UPLOADEDCounting requests…
How to use this tool

What it does

Reads SQL statements and explains them in plain English: the order Db2 works in, the host variables and the SQLCODEs to expect.

How to use it

  1. Paste one or more SQL statements.
  2. They are read as you paste; no button is needed.
  3. Read the order Db2 works in, the host variables and the SQLCODEs to expect.

What it cannot do

  • It does not know your tables, so it cannot tell if a column can be null or a key is unique.
  • It explains the statement, not its performance.
  • Some statement kinds and clauses are named as not interpreted.

SQL · paste one or more statements
EXEC SQL ... END-EXEC is read tooon this device

Your SQL is kept in this browser to save retyping. Clear it or keep it for this tab only on the Privacy page.

Statements end with a semicolon, or sit between EXEC SQL and END-EXEC. The tool reads the text only: it has no table definitions, no bind options and no connection to Db2.

Covers: SELECT, SELECT INTO, DECLARE CURSOR, OPEN, FETCH, CLOSE, INSERT, UPDATE, DELETE, MERGE, COMMIT, ROLLBACK, GRANT, REVOKE and the common CREATE, ALTER and DROP forms, written as plain SQL or inside EXEC SQL ... END-EXEC. Other statements and clauses are named as not interpreted.

ACCURACY · SIMULATION · CONFIRM ON Z/OS

Reads the text of the statement only; it has no catalog, no table definitions and no bind options, so anything that depends on them is marked as such. Syntax it does not interpret is named, not guessed. Confirm on Db2.

What it checks

  • ConfirmedThe order Db2 works through a query: FROM, WHERE, GROUP BY, HAVING, the select list, ORDER BY, then OFFSET and FETCH FIRST.
  • ConfirmedSELECT INTO: no row gives SQLCODE +100, more than one row gives -811, and a null value with no indicator variable gives -305.
  • ConfirmedHost variables: which ones Db2 reads (input) and which it fills (output), and whether each has an indicator variable.
  • ConfirmedCursors in the order written: OPEN of an open cursor, FETCH or CLOSE of a closed one, positioned UPDATE or DELETE on a cursor declared without FOR UPDATE.
  • Depends on your systemThe isolation clause (WITH UR, CS, RS, RR) and the bound default when there is none.
  • ConfirmedSQLCODE and SQLSTATE tests in the surrounding COBOL, linked to the matching code page when this site has one.

What it does not check

  • Depends on your systemTable and column definitions, so whether a column can be null, a key is unique or a table exists is never known.
  • Depends on your systemBind options, access paths and what the optimizer chooses; the tool explains the statement, not its performance.
  • UnsupportedRecursive common table expressions, XML and JSON functions, temporal tables, window functions, GROUPING SETS, ROLLUP, CUBE, table functions and rowset processing.
  • UnsupportedClauses after the column list of CREATE TABLE, details of ALTER actions, and CREATE for objects other than TABLE, INDEX and VIEW.

Source

Simulation, confirm on z/OS. Status labels: Confirmed Depends on your system Unsupported (a rule with an official source; depends on your catalog, security, installation defaults or compiler options; not parsed and shown instead of guessing).

Input limits and example

  • SQL text: 200,000 characters.

EXAMPLE INPUT

SELECT NAME, BAL INTO :CUST-NAME :CUST-IND, :CUST-BAL
  FROM ACCT
  WHERE ID = :CUST-ID

Check it yourself in one minute

  1. Open your browser's developer tools: in Chrome or Edge press F12 or right-click and choose Inspect; in Firefox press Ctrl+Shift+E for the Network Monitor; in Safari first turn on Show features for web developers under Settings, Advanced. Then open the Network tab.
  2. Keep the log across page loads (Chrome: Preserve log; Firefox: Persist Logs), then use the tool: paste your text or open a file and press the button.
  3. Look at the list. You will see only this page and its own files, loaded when the page opened. Nothing new appears when you use the tool.
  4. Still unsure? Switch Wi-Fi off and try again. The tool still works.

What the badge counts: requests the browser logged after this page finished loading, other than the site's own files. It reads the browser's own record and makes no request of its own. If your browser cannot give that record, the badge says so. The badge is a convenience; the developer tools are the proof.

The rule that enforces it

Every page carries this Content Security Policy. The browser itself refuses any request outside it; connect-src 'none' blocks fetch, XHR and WebSocket.

default-src 'none';
script-src 'self';
style-src 'self';
img-src 'self' data:;
font-src 'self';
connect-src 'none';
object-src 'none';
form-action 'none';
base-uri 'none';
manifest-src 'self';
worker-src 'self'