... I always used SQL views and added only the where conditions and order by
clauses to the statement.
This was the way we had to use it in RPGIII with a maximum length 255 Bytes
for character fields.
BTW moving business logic into SQL views is a really good idea, for masking
complexity, for reducing source code and for making the SQL code reusable.
Because an SQL view never has a key, that has to be updated with any change
in the base tables, you can have thousands of views without any performance
decrease.
Mit freundlichen Grüßen / Best regards
Birgitta Hauser
"Shoot for the moon, even if you miss, you'll land among the stars." (Les
Brown)
"If you think education is expensive, try ignorance." (Derek Bok)
"What is worse than training your staff and losing them? Not training them
and keeping them!"
-----Ursprüngliche Nachricht-----
Von: MIDRANGE-L [mailto:midrange-l-bounces@xxxxxxxxxxxx] Im Auftrag von
Tyler, Matt
Gesendet: Friday, 13.5 2016 01:10
An: midrange-l@xxxxxxxxxxxx
Betreff: RE: SQL Statement length
"As another "fly in the ointment"....we're running V5R4"
So what I have done for my extra-large queries is to load them into a
compile time array then read the array into the varying character field then
use that carrying char field as would other dynamic statement variables.
In 5.4 format
D QRY_STMT S 100a DIM(100) CTDATA
D STMTSQL S 32740a Varying
D IDX S 10I 0
...
For IDX = 1 to %ELEM( QRY_STMT ) by 1;
STMTSQL += %TRIM( QRY_STMT( IDX ) ) +' '; Endfor; ...
// Follow normal prep, declare, open, fetch and close procedures.
** - QRY_STMT
select field1, field2, field3, field4
from mytable
where field1 = 'A'
Thanks, Matt
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx To subscribe, unsubscribe,
or change list options,
visit:
http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx Before posting, please take a
moment to review the archives at
http://archive.midrange.com/midrange-l.
Please contact support@xxxxxxxxxxxx for any subscription related questions.
As an Amazon Associate we earn from qualifying purchases.