Possible host languages for dynamic SQL applications
Programs that use dynamic SQL are usually written in assembler, C, PL/I, REXX, and COBOL. All SQL statements in REXX programs are considered dynamic SQL.
You can write non-SELECT and fixed-list SELECT statements in any of the Db2 supported languages. A program containing a varying-list SELECT statement is more difficult to write in Fortran, because the program cannot run without the help of a subroutine to manage address variables (pointers) and storage allocation.
Most of the examples in this topic are
in PL/I. Longer examples in the form of complete programs are available
in the sample applications:
- DSNTEP2
- Processes both SELECT and non-SELECT statements dynamically. (PL/I).
- DSNTIAD
- Processes only non-SELECT statements dynamically. (Assembler).
- DSNTIAUL
- Processes SELECT statements dynamically. (Assembler).
Library prefix.SDSNSAMP contains the sample programs. You can view the programs online, or you can print them using ISPF, IEBPTPCH, or your own printing program.
You can use all forms of dynamic SQL in all supported versions of COBOL.