Re: CLOB fields

Daniel Gross <[email protected]> Sat, 6 Jun 2026 14:13:57 +0200
Newsgroups gmane.comp.hardware.ibm.midrange
Message-ID <[email protected]>
Yes - that would be cool - but SQL has the VARCHAR limit of 32xxx chars/bytes. 

So you can only cast (SQL) CLOB to (SQL) VARCHAR to that length. 

My solution is always, to "overlay" the CLOB field(s) with a (RPG) VARCHAR(xxx:4) variable - either by pointer or by POS/SAMEPOS. 

Regards,
Daniel



> Am 06.06.2026 um 13:47 schrieb Jon Paris <[email protected]>:
> 
> Where possible (i.e. below 16Mb) wouldn't it be better to have SQL bring them into a VARCHAR?  Why mess with lengths when the code can do it for you?
> 
> 
> Jon Paris
> [email protected]
> 
> 
> 
>>> On Jun 5, 2026, at 3:15 PM, David Gibbs via MIDRANGE-L <[email protected]> wrote:
>>> 
>>> 
>>>> On Jun 5, 2026, at 2:18 AM, Daniel Gross <[email protected]> wrote:
>>> 
>>> If you want the content in RPG your best bet is to use a variable of SQLTYPE(CLOB:<size>). This results in a special data structure with a _LEN and _DATA subfield, that you can use from RPG. And the contents of your CLOB are fully copied into memory.
>> 
>> FWIW: I submitted an idea to allow the data and length subfields to be accessed more idiotically.
>> 
>> Instead of ‘clobfield_data’ and ‘clobfield_len’, the subfields would be qualified, clobfield.data & clobfield.len.
>> 
>> https://ideas.ibm.com/ideas/IBMI-I-4759
>> 
>> david
>> 
>> --
>> This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
>> To post a message email: [email protected]
>> To subscribe, unsubscribe, or change list options,
>> visit: https://lists.midrange.com/mailman/listinfo/midrange-l
>> or email: [email protected]
>> Before posting, please take a moment to review the archives
>> at https://archive.midrange.com/midrange-l.
>> 
>> Please contact [email protected] for any subscription related questions.
>> 
> 
> --
> This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
> To post a message email: [email protected]
> To subscribe, unsubscribe, or change list options,
> visit: https://lists.midrange.com/mailman/listinfo/midrange-l
> or email: [email protected]
> Before posting, please take a moment to review the archives
> at https://archive.midrange.com/midrange-l.
> 
> Please contact [email protected] for any subscription related questions.
> 
-- 
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: [email protected]
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/midrange-l
or email: [email protected]
Before posting, please take a moment to review the archives
at https://archive.midrange.com/midrange-l.

Please contact [email protected] for any subscription related questions.