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



CLOB/DBCLOB/BLOB-Data stored in CLOB/DBCLOB/BLOB-Data stored in an SQL
Tables, can be accessed using LOB-Host Variables.
The downside of LOB-Host-Variables is, the data is copied into the host
variables and the maximum length depends on the language restrictions, i.e.
in RPG the maximum length for a character variable is 16MB (compared with 2
GB, the maximum length of a LOB column).
The content of a LOB Variable can be accessed with native RPG
(built-in-)functions.
A LOB variable is defined with the keyword SQLTYPE
Example:
D MyCLOB S SQLTYPE(CLOB: 100000)
/Free
Select ClobColumn into :MYCLOB
From ....
Fetch First Row Only;

Data = %Subst(MyClob_Data: 1: 100);

Using LOB Locators is a better solution. A LOB Locator is a kind of pointer
that points to the data in the LOB column, but does not copy the data into
any variable.
LOB Locators can be used in composition with SQL scalar functions like any
character variable.
Commitment Control is required!
Example:
D MyCLOB S SQLTYPE(CLOB_Locator)
/Free
Select ClobColumn into :MYCLOB
From ...
Fetch First Row Only;

Exec SQL Set :Data = Substr(MYCLOB: 1: 100);

With LOB file referece variables data located in IFS files can be accessed
with (embedded) SQL.
Like LOB Locators LOB file reference variables only point onto the data, but
do not copy them.
LOB File Reference Variables can be used in composition with SQL Scalar
functions like any character variable:

D MyCLOB S SQLTYPE(CLOB_File)
/Free
Clear MyClob;
MyClob_Name = '/home/YourDirectory/YourIFSFileName.ext';
MyClob_NL = %Len(%Trim(MyClob_Name));
MyClob_FO = SQFRD; //Read Only

Exec SQL Set :Data = Substr(MyCLOB: 1: 100);


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: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] Im
Auftrag von RPGLIST
Gesendet: Thursday, 19.9 2013 15:21
An: rpg400-l@xxxxxxxxxxxx
Betreff: Avoiding disk arms with CLOB

I'm facing the need to process a very large amount of data, which is more
than likely going to come in as a SOAP or XML stream but I need to process
this quickly and without losing time with the disk arms if at all possible.

I know that a clob will allow me to store a larger set of data but from what
I'm reading, you can't just access and read it like a normal variable.

I assume, and if I'm wrong feel free to slap with a lead pipe, that like
with regular PF's writes are going to cost me time. I know some individuals
don't care about time or say its not important but I need to return a
response in a matter of seconds like 5-8 or lower if possible and I'm not
going to argue that point. It is what it is.

The data coming in if you put it in a PF would have a record length of
somewhere in the 12k range, so you can imagine it'll be larger with XML tags
and that's a single record, whereas we could receive up to 99 lines with
each line in the 12k+ range.

Now, if someone has a suggestion I'm all ears :)



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



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.