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

I was surprised that SEU didn't object and prefer the mixed case for
readability so I left them in. I figured that the pre-compiler probably
used the same engine for both SQLRPG and SQLRPGLE source as the lines are
(to all intents and purposes) free-format. Certainly the prepare statement
isn't returned as an error, so I guess it's okay.

Cheers

Jonathan



-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx]
On Behalf Of J.Beckeringh@xxxxxxxxxxxxxxxxxxxxxxxxxx
Sent: 15 June 2010 13:15
To: RPG programming on the IBM i / System i
Subject: Re: SQL cursor declaration in RPG 400 program

Jonathan,

The first thing to catch the eye is the use of lower case in RPG/400. I'm
surprised that the SQL-statements appear to be accepted, but I would
certainly try to specify all names in upper case.

Joep Beckeringh


Jonathan Mason

Hi Everyone

I'm having to modify an old, old, old RPG 400 program and need to embed
some SQL into it, however after making my changes the SQL pre-compiler
throws out an error saying that the cursor needs to be defined first.

The section of code that prepares, declares and opens the cursor looks
like this:

<snip>
6992 C/Exec SQL
6992 C+ Prepare prpSQL from :wSQL
6992 C/End-Exec
6992 C*
6992 C* 4. If there were no errors then declare the cursor...
6992 C*
6992 C SQLCOD IFEQ *ZEROS
6992 C*
6992 C/Exec SQL
6992 C+ Declare csrSQL cursor for prpSQL
6992 C/End-Exec
6992 C*
6992 C* 5. If there were no errors then open the cursor...
6992 C*
6992 C SQLCOD IFEQ *ZEROS
6992 C*
6992 C/Exec SQL
6992 C+ Open csrSQL
6992 C/End-Exec
6992 C ENDIF
</snip>

However, the pre-compiler report shows the following errors:

Record *...+... 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+...
258 6992 C+ Close csrSQL
780 6992 C+ Open csrSQL
796 6992 C+ Fetch csrSQL into :wRRNA, :wRRNB, :wTYPE
5722ST1 V5R4M0 060210 Create SQL RPG Program
DIAGNOSTIC MESSAGES
MSG ID SEV RECORD TEXT
SQL0504 35 258 Position 16 Cursor CSRSQL not declared.
SQL0504 35 780 Position 15 Cursor CSRSQL not declared.
SQL0504 35 796 Position 16 Cursor CSRSQL not declared.

I have a similar piece of code in an ILE module and that compiles fine.
I can't see anything obviously wrong with the code and was wondering if
anybody had any ideas?

Thanks

Jonathan

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.