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



On 2023-01-21 11:04 a.m., Daniel Gross wrote:
...
Well - the 7.4 RPG compiler for sure supports *AUTO - but I would bet, that the SQL pre-compiler doesn’t support it - maybe even not on 7.5.
...

The SQL precompiler does support *AUTO in 7.4.

I think the coolest thing they do is this: If you use a *AUTO data structure in a FETCH, it will set the dimension to the number of rows returned.

For this program:

dcl-ds ds extname('BMORRIS/MYFILE') qualified dim(*auto : 10) end-ds;

EXEC SQL DECLARE C1 CURSOR FOR SELECT * FROM bmorris/myfile;
exec sql open c1;

dsply (%elem(ds)); // displays 0
EXEC SQL FETCH C1 FOR 10 ROWS
INTO :ds;
dsply (%elem(ds)); // displays 3

exec sql close c1;
*inlr = *on;

Here's what the SQL precompiler generates for the FETCH:

//* EXEC SQL FETCH C1 FOR 10 ROWS
//* INTO :ds;
SQLER5 = 10;
%ELEM(DS : *ALLOC) = 10;
SQLER6 = -4;
SQCALL000003(
SQLCA
: SQL_00006
: DS
);
%ELEM(DS : *KEEP) = SQLER3;


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.