Sure like so....

HdrString = 'INSERT Into ' + %trim(Library) + '/' + %trim(HdrFile) +  
'Values(?,?,?,'
+' ?,?)'; 


Thanks,
Tommy Holden


-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Jerry Adams
Sent: Friday, July 28, 2006 11:57 AM
To: RPG programming on the AS400 / iSeries
Subject: Re: PREPARE Statement Problem

Something was, indeed, wrong with the PREPARE statement.  Or more 
precisely its placement.


Normally, I suppose (since I'm new to this), one would be dealing with a

database on which the program is running.  I was connecting to a 
database on a different box.  The problem, as it turns out, was that I 
placed the CONNECT statement *after* the PREPARE's.  A little bit of 
info I neglected to include in my tome, thinking it wasn't relevant 
since eventually the connection was made. 


Once I out the CONNECT *before* the PREPARE's, everything was
hunky-dory. 


It was Tommy who put me on the right track (shame on me for being mean 
to him; I'll buy you a drink at the next user group meeting) by 
suggesting that I look at the sqlcode and sqlstate values.  They weren't

exactly crystal clear, but a heck of a lot better than the job log.

And I did have to use the cutesy little 67 parameter marker variable 
from the D-specs.  Is there a way to continue the VALUES clause when 
building it in a string in calcs, such as:


HdrString = 'INSERT Into ' + %trim(Library) + '/' + %trim(HdrFile) +  ' 
Values(?,?,?,
    ?,?)';


Just seems that, since it's part of a quoted string, there's no way to 
do the continuation with a '+' as it would think that (and the blanks) 
were part of the quote.


Thanks for the help, guys. 


        * Jerry C. Adams
*IBM System i Programmer/Analyst
B&W Wholesale Distributors, Inc.* *
voice
        615.995.7024
fax
        615.995.1201
email
        jerry@xxxxxxxxxxxxxxx <mailto:jerry@xxxxxxxxxxxxxxx>



Wilt, Charles wrote:

Jerry,

The 10 parameter markers should work, assuming that none of the fields
left out are defined with a default value or they allow NULL.  (In
other
words, you're not required to fill in a value.)

The 67 parameter marker version should work.

Try taking a look at SQLSTT/SQLCOD after the prepare statement.  The
SQL0518 - Prepared statement *N not found. Error leads me to believe
that something is going wrong during the prepare.

Charles Wilt
--
iSeries Systems Administrator / Developer
Mitsubishi Electric Automotive America
ph: 513-573-4343
fax: 513-398-1121
 

 



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.