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



Alan,
I might be remembering incorrectly, but I *think* that the declare cursor
must be in the main line, not the sub-procedure.


Jeff Young
Sr. Programmer Analyst

On Thu, May 11, 2017 at 7:07 AM, Alan McKenzie <amckenzie@xxxxxxxxxxx>
wrote:

Hi,

I recently wrote a program that uses SQL to process all tables/files. The
program has a very short main section, 4 statements, followed by all the
Procedures. When compiling the program I am getting an horrendous number
of errors, all associated with SQL. If I change the program to use
Sub-routines instead of the Procedures, the compilation completes
successfully.

Initially I thought that possibly the SQL Communication Area (SQLCA data
structure) may not have been created in the correct section, but that is
not the case. It appears that FETCH, SELECT, OPEN data structures are in
the certain Procedures and can't be accessed from other procedures.

I can supply both compilation reports if required to assist.

Has anyone had a similar issue and could make some suggestions to remedy
the situation.

Regards,

Alan McKenzie
XA Consultant
CBI electric Telecom Cables (Pty) Ltd.
Registration Number: 1967/005978/07
Office: +27 12 381 1405 | Switchboard: +27 12 381 1400
Mobile: +27 (0) 82 453 7990
E-mail: AMcKenzie@xxxxxxxxxxx<mailto:AMcKenzie@xxxxxxxxxxx>
NOTE:- This e-mail message and all attachments hereto contain confidential
information intended for specific addressee and purpose. If you are not
the addressee:
(a) You may not disclose, copy, distribute or take any action based
on the contents hereof.
(b) Kindly inform the sender immediately and destroy all copies
thereof.
(c) Any discloser, copying, distribution or any action taken or
omitted in reliance on it, is prohibited and may be unlawful.
The views and opinions expressed in this e-mail message may not
necessarily be those of the management of the company.

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

Please contact support@xxxxxxxxxxxx for any subscription related
questions.

Help support midrange.com by shopping at amazon.com with our affiliate
link: http://amzn.to/2dEadiD


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.