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



The source you supplied in your example does not seem to match the error
section. All the lines in the source are numbered 6992 while the errors
indicate problems at lines 258, 780, 796. That is, unless this is a
difference at your OS level or some strange compile option.

Note that (this is not part of your problem, but) you cannot condition the
definition of a cursor. It is defined at compile time, in spite of any
surrounding IF condition tests, and has nothing to do with SQL status.
(This is tantamount to defining a file on the file specs.) So your
following IF could be removed, along with its accompanying ENDIF:

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*


Dennis Lovelady
http://www.linkedin.com/in/dennislovelady
--
"People are usually more convinced by reasons they discovered themselves
than by those found by others."
-- Blaise Pascal

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.



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.