× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



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
(substr('1234567890abcdefghij',1,10)),
(substr('1234567890abcdefghij',11,10))

But, I can't figure out how to use a select statement to drive multiple
values.

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.

Mike

-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx
[mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of eftimios pantzopoulos
Sent: Monday, June 25, 2007 6:36 PM
To: midrange-l@xxxxxxxxxxxx
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
characters.

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
(http://publib.boulder.ibm.com/infocenter/iseries/v5r3/index.jsp) and
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)


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.