× 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.



Gary,

I have done exactly what you describe, copying the content of the SQL string
to the clipboard, then using F21 to bring up a command entry window, and
starting interactive SQL and pasting the string contents into SQL. It
creates the file with 380 records just fine, in the same session as the
debug. I have also copied the string to a different session and it works
fine there as well.

Tom


-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx]
On Behalf Of Monnier, Gary
Sent: Wednesday, March 20, 2013 5:16 PM
To: RPG programming on the IBM i (AS/400 and iSeries)
Subject: RE: Differences between STRSQL and embedded SQL

Thomas,

Try putting the program in debug with a break point right after you set the
SQL string. Now copy the string to an interactive session and see if it
runs. You might find the string's formatting isn't what you expect.

-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx]
On Behalf Of DeLong, Eric
Sent: Wednesday, March 20, 2013 3:10 PM
To: RPG programming on the IBM i (AS/400 and iSeries)
Subject: RE: Differences between STRSQL and embedded SQL

Is there some special reason you must build the string, then prepare? I'd
suspect something is wrong with your SQL string, but there's no way to know
without debug... Static SQL allows the compiler to verify your statement...

-Eric DeLong

-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx]
On Behalf Of Thomas Garvey
Sent: Wednesday, March 20, 2013 4:20 PM
To: 'RPG programming on the IBM i (AS/400 and iSeries)'; 'Midrange Systems
Technical Discussion'
Subject: Differences between STRSQL and embedded SQL

I'm working on an embedded SQL command that would create a temporary file of
random records from another file. The SQL statement works when executed
interactively using STRSQL, but fails with SQL0117 (Statement contains wrong
number of values).

Here's the SQL statement...

create table qtemp/F3003 as (select IREFFF,rand() as idx from QGPL/F3003
order by idx fetch first 380 rows only) with data

So, F3003 exists as a table with 50 fields, and some 40,000 records. This
statement should create a new table in qtemp with 380 records, consisting
only of the IREFFF field and a random number, cast as field idx.

It works fine interactively. But when this statement is performed in RPGLE
embedded SQL (as a string, which is then PREPAREd and EXECUTEd), I get the
SQL0117. When I look up the SQL0117 explanation, I don't see that any of
the conditions exist.

Anyone have any ideas? And I always thought: if I could do it
interactively, I could certainly do it in embedded SQL.

Best Regards,

Thomas Garvey

--
This is the RPG programming on the IBM i (AS/400 and iSeries) (RPG400-L)
mailing list To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe,
unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives at
http://archive.midrange.com/rpg400-l.

--
This is the RPG programming on the IBM i (AS/400 and iSeries) (RPG400-L)
mailing list To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe,
unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives at
http://archive.midrange.com/rpg400-l.

--
This is the RPG programming on the IBM i (AS/400 and iSeries) (RPG400-L)
mailing list To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe,
unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives at
http://archive.midrange.com/rpg400-l.




As an Amazon Associate we earn from qualifying purchases.

This thread ...

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.