Dynamic operations in ALLBASE/SQL are of two major types:
Dynamic Non-Queries: dynamic operations that do not retrieve rows from
the database. Note that dynamic non-queries either do or do not require
the use of sections at execution time. For example, a CONNECT does not
require a section, but a DELETE does.
Dynamic Queries: dynamic operations that do retrieve rows. Note
that dynamic queries may have a query result whose format is
known to you at programming time, or they may have a query result whose
format is unknown. Dynamic queries always use sections at
execution time.
COBOL does not permit dynamic queries. However,
you can call a C or Pascal routine from your COBOL program. This technique
is discussed under "Preprocessing of Dynamic Queries with C or Pascal Routines" below.
You can use either the EXECUTE IMMEDIATE command or the PREPARE and EXECUTE
commands to handle non-query dynamic commands.
The following paragraphs first examine
COBOL queries using C or Pascal routines, then examine COBOL non-queries
using the EXECUTE IMMEDIATE or PREPARE and EXECUTE commands.