On 30-Nov-2011 08:51 , David Gibbs wrote:

I've got a problem where I need to analyze and manipulate very large
blocks of character data.

This character data could be well in excess of 64k.

Since the limit for RPG character fields on 5.4 is 64k ... I can't
use
normal BIF's.

Upgrading to 6.1 isn't an option due to customer requirements (this
was my first idea, but it got shot down).

My current thought is to use pointers and C functions to analyze
the text in the space. <<SNIP>>I'm not super happy with the idea of
having to deal with this data using pointers and C api's ...
Any suggestions on a different approach to handling these large
character variables?


How about using some SQL procedures [and\or functions] to perform the work using CLOB data type, since SQL has similar capability to various RPG BIFs? For example a scan implemented as a procedure might look like:

<code>

drop procedure ScanChunks
;
create procedure ScanChunks
( LocPos out int
, ScnStr in varchar(200) ccsid 37
, chnk01 in char(32766) ccsid 37
, chnk02 in char(32766) ccsid 37
) language sql
set option dbgview=*SOURCE
begin
set locpos=locate(scnstr,cast(chnk01 as clob(32k) ccsid 37)
concat cast(chnk02 as clob(32k) ccsid 37));
end
;

</code>

A program that calls the above procedure. The data chunks declared in automatic storage in this test program would be replaced by the memory allocated in the real program.

<code>

h dftactgrp(*no)
d Str1@ S *
d Str1 S 32766A based(Str1@)
d Str2@ S *
d Str2 S 32766A based(Str2@)
D Srch S 200A varying inz('r s')
D Pos S 10i 0
d* represent the allocated storage for this test program
d Chnk1 S 32766A inz(' ')
d Chnk2 S 32766A inz('other stuff')
D DspOut S 30A varying
C/Free
Exec SQL
Set Option Commit=*NONE, DatFmt=*ISO
Str1@ = %Addr(Chnk1);
Str2@ = %Addr(Chnk2);
Exec SQL
call scanchunks(:pos, :srch, :str1, :str2) ;
if pos<>0;
dspout='Found it!' + %editc(pos:'Z');
else;
dspout='Not found!'+ %editc(pos:'Z');
endif;
DSPLY dspout ;
*inlr = *on;
/end-free

</code>

Regards, Chuck

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

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.