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



It would be helpful if your question was a little more specific. Not sure
where I got them from (probably off this list) but below are some really
simple examples of an SQL sentence in an RPG program.

Hope this helps.

Glenn Gundermann
ggundermann@xxxxxx
(647) 272-3295


exec sql set option datfmt=*iso,
closqlcsr=*endmod;

exec sql declare DemoCursor cursor for
select
PROMO,
FIRST,
LAST
from SQL_DEMOP
where FIRST <= :MyDate
and LAST >= :MyDate
order by PROMO
;

exec sql open DemoCursor;
if SQLSTT <> SQLSuccess;
SQLProblem('open DemoCursor');
endif;

FetchCur();
dow SQLSTT = SQLSuccess;
// Program logic here
FetchCur();
enddo;

exec sql close DemoCursor;
if SQLSTT <> SQLSuccess;
SQLProblem('close DemoCursor');
endif;

where FetchCur() looks like this:

exec sql fetch DemoCursor into
:MyPromo,
:MyFirst,
:MyLast
;
if SQLSTT <> SQLSuccess
and SQLSTT <> SQLNoMoreData;
SQLProblem('fetch DemoCursor');
endif;



How I can and control an SQL sentence from a RPG program?


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.