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



Hi Rob,

>> Debugging SQL is always a challenge.  The debugger often positions you 
>> rather arbitrarily.

>> Do you know where it died?  On the PREPARE, the Declare, OPEN, or what? 

My code was of the form (from memory):

C/exec sql
C+ Whenever sqlerror goto errorTag
C/end-exec

C/exec sql
C+ Prepare stmt1 from :String1
C/end-exec

C/exec sql
C+ Execute stmt1
C/end-exec

C         ErrorTag           Tag

C                            Eval    *inLR = *on
C                            Return

The string contained a series of inserts delimited by a ";".

I was trying to prepare a full transaction, but this would simply cause an
sql error. The prepare would fail because a ";" was not expected. This was
fine, I would move down to the errorTag and exit the program normally.

What was really bizarre was that the job wouldn't necessarily end during the
SQL processing. I could seton LR, return to the caller, the caller could
seton LR and the job would just pop - I'd get a "Job Ended Abnormally"
message and a joblog to look through. After starting a new session, the next
time I ran the program it may not blow up at all, but a second call may end
the job when I process the prepare. The point at which the job ended seems"
arbitrary.

This never happened if I simply ran the program - it only ever happened
during debug.

Is there a reason why this could happen? I can't see why a failed prepare
should crash a whole job out - especially when I had a "whenever sqlerror"
check in my code. There must be more that I'm missing.

I now have the program parsing the string and running the insert statements
individually (in a dow loop). Is this the way to do it? Or is there a better
way to run a series of sql statements contained within a stream file?  

Thanks for your help.

Larry 


As an Amazon Associate we earn from qualifying purchases.

This thread ...


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.