Subject transient data sets and procedures
Author Ann W. Harrison
Toward the end of the discussion of transient data sets about a month
ago, I ran into the problem of using the very dynamic data sets with
procedures, which are inherently static. At the time, I hoped for some
insight that would let a procedure accept references to something that
didn't exist - wasn't even defined - when the procedure was created.

That's a dead-end. The most similar problem that came to mind is a
preprocessed program that creates and uses tables. The preprocessor
ordinarily uses the system tables for the target database to find the
table structures and field types for the data it uses. However, it also
accepts a syntax like DECLARE RELATION ... that describes tables that
will exist when the program is run, but do not currently exist. I
suggest that transient data sets could be introduced to procedures in a
similar fashion.

Currently stored procedures declare variables in a sort of procedure
preamble. They could declare the names of temporary data sets and the
names and datatypes of their fields in the same fashion. During
procedure compilation - from PSQL to blr - those declarations would be
used to resolve references to temporary data sets - those defined
within the procedure and those created outside the procedure.

Not terribly elegant, but sufficient, I think.