How to access “IMS DB” database using SQL Queries(1 of 2)

Like DB2, IMS DB lets you run SQL queries against its database. Follow these basic steps to set up and use SQL access:

Steps to Enable SQL Access to IMS DB

  1. Make the required changes in the DBD (Database Descriptor)
  2. Set up IMS Connect
  3. Install IMS V13 or later, which supports SQL query access to IMS DB
  4. Currently, this feature works only in programs that run as MPP, BMP, or IFP
  5. You can issue SQL queries and DL/I calls concurrently within the same program
  6. To use both SQL and DLI together, compile your program with the IMSSQL compiler
  7. For SQL access, use the DFSCAT00 Program as the executable
  8. Note: This feature does not yet support IMS Batch applications (DBCTL)

Supported SQL Statements

CLOSE – The CLOSE statement closes a cursor.

DECLARE CURSOR – The DECLARE CURSOR statement defines a cursor.

DECLARE STATEMENT – Use DECLARE STATEMENT for application program documentation. It declares names that identify prepared SQL statements.

DELETE – The DELETE statement removes rows from a table.

DESCRIBE OUTPUT – The DESCRIBE OUTPUT statement retrieves information about a prepared statement.

EXECUTE – The EXECUTE statement runs a prepared SQL statement.

FETCH – The FETCH statement positions a cursor on a row of its result table. It returns zero or one row and assigns the row’s values to host variables when you provide a target specification.

INCLUDE – The INCLUDE statement inserts application code — including declarations and statements — into a source program.

INSERT – The INSERT statement adds rows to a table.

OPEN – The OPEN statement opens a cursor so you can use it to process rows from its result table.

PREPARE – The PREPARE statement builds an executable SQL statement from a character string (called a statement string). The result is called a prepared statement.

SELECT – The SELECT statement retrieves data from one or more tables and returns the result as a tabular result set.