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



The inner cast of LISTAGG must be the max size of the combined string of all elements aggregated together.

Which means you would need something like:
LISTAGG( CAST( something as CLOB(1G) ) )

Based on what you have coded, the LISTAGG is only returning 1k combined.
LISTAGG( CAST( something as CLOB( 1K ) ) )


Chris Hiebert
Senior Programmer/Analyst
Disclaimer: Any views or opinions presented are solely those of the author and do not necessarily represent those of the company.


-----Original Message-----
From: RPG400-L [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of orlando misas
Sent: Tuesday, September 18, 2018 9:53 PM
To: RPG programming on the IBM i (AS/400 and iSeries) <rpg400-l@xxxxxxxxxxxx>
Subject: Error handing field CLOB

Hi,

I have a file with 38000 records, the record has only one field char(900).
I need to join these fields in a single field type CLOB (1G). The file size
exceeds 30 megabytes . I use the following instruction:

SELECT CAST ( LISTAGG ( CAST ( TRIM ( FIELD ) AS CLOB ( 1 K ) ) ) AS CLOB
( 1 G ) )
INTO VARIABLE
FROM LIBRARY.FILE ;

Where VARIABLE is CLOB ( 1 G)

When I execute this sentence, I obtain an error, because the result is
greater than one mega then I change the instruction by:

SELECT GET_CLOB_FROM_FILE ( 'LIBRARY/FILE(MEMBER)' , 0 )
INTO VARIABLE
FROM SYSIBM . SYSDUMMY1
WITH CHG ;

This instruction run ok, but the content of the variable is incomplete
because it cuts information from the records that it unites.

Example:

-First records of the file:
<ARInvoiceDataSet>
<InvcDtl>
<Company>81</Company>
<InvoiceNum>10771</InvoiceNum>
<InvoiceLine>1</InvoiceLine>
<PartNum>E12720-60-999</PartNum>
.....
.....

- Expected string:
<ARInvoiceDataSet><InvcDtl><Company>81</Company><InvoiceNum>10771</InvoiceNum><InvoiceLine>1</InvoiceLine><PartNum>E12720-60-999</PartNum>.........


- Obtained string:
Dtl><Company>81</Company><InvoiceNum>10771</InvoiceNum><InvoiceLine>1</InvoiceLine><PartNum>E12720-60-</PartN>....


This process is in iSeries V7.3 in a store procedure sql pure.

Does anybody have an idea?

Thank you.

Orlando Misas

As an Amazon Associate we earn from qualifying purchases.

This thread ...


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.