Interesting question overall...
There is support writing multiple records at one time in db2 SQL. If you
just had a string, you could do something like this:
INSERT INTO QTEMP/MAK (TEST1) VALUES
But, I can't figure out how to use a select statement to drive multiple
Googling finds several references to folks that have tried creating multiple
records from a single record (for example, separating a comma delimited list
into separate records). They all look quite "messy". Creating a function or
some kind of temporary table might be an answer. There seem to a couple of
"split" functions that folks have created that would have potential.
If you don't get an answer here, try Howard Arner or Ted Holt at
itjungle.com. They both seem to relish a SQL challenge.
] On Behalf Of eftimios pantzopoulos
Sent: Monday, June 25, 2007 6:36 PM
Subject: Re:RUNSQLSTM Source File Record Length
Thanks to all for the contributions to this problem.
I'm actually using SQL to generate the SQL source to the source member.
This is driven from a file which contains table & column information
extracted from the system catalog. I just use an INSERT INTO lib/file
(select string ...........) to generate each line. The string is just
another SQL statement that will be executed through RUNSQLSTM afterwards.
Sounds a bit complicated, but I was just doing it as an exercise. It
actually works, except for the fact that the output is greater than 80
So each select statement can create only one line of output.
I could always use RPG or CL to break up a longer line into the acceptable
length, and place the semi-colon on a new line, but I just thought SQL was
quicker and easier.
As for RTFM. With information spread all over the place these days, I use
GOOGLE for everything because it gives me a broader range of ideas (and more
interesting) to solve problems. I just searched in the infocenter again
entered RUNSQLSTM and couldn't find a specific statement re the 80
characters which I'd presumed was the reason anyway. By the way. Why are
21st century structures still tied to 80 character punched card antecedents?
Anyway, what I was actually after was a trick to generate two lines from an
SQL select statement, which I would guess doesn't exist.
Regards, Mike Pantzopoulos
0403 809 442 (mob)