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
- Make the required changes in the DBD (Database Descriptor)
- Set up IMS Connect
- Install IMS V13 or later, which supports SQL query access to IMS DB
- Currently, this feature works only in programs that run as MPP, BMP, or IFP
- You can issue SQL queries and DL/I calls concurrently within the same program
- To use both SQL and DLI together, compile your program with the IMSSQL compiler
- For SQL access, use the DFSCAT00 Program as the executable
- 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.
