Previous Topic: Data Definition ConventionsNext Topic: SQL Dataviews


SQL Concepts and Language Elements

CA Ideal supports SQL access to CA Datacom/DB and DB2 in PDL programs. This chapter describes the SQL statements and search conditions CA Ideal supports.

You can code embedded SQL statements directly in a CA Ideal program's procedure section. SQL statements are delimited by the words EXEC SQL and END‑EXEC. The features of SQL embedded in a CA Ideal application follow the rules and descriptions for embedded SQL in a COBOL environment, except where noted in this section. The EXEC SQL statement is described in the "Built-In Functions" chapter.

The CA Ideal editor lets you enter template commands in the margin of the program procedure fill‑in. SQL template commands automatically generate syntactically correct SQL statements. SQL template commands are described in the CA Ideal Command Reference Guide.

You can also use the FOR construct to access databases using SQL. When you use the FOR construct with a dataview defined to access an SQL object, CA Ideal automatically generates optimized SQL statements to perform the same functions. For description of the FOR statement, see the "Built-In Functions" chapter.

You can print the generated SQL on the compiler listing. For more information about COMPILE command, see the Command Reference Guide.