I've added in the allocated data structure logic per your article (not yet tested, but it compiled so that's a start). I'm now trying to build a giant string and I'm having issues. The DS stuff worked b/c field sizes aren't changing, I just moved from having an explicit array to using a pointer instead. But for the single field, I have to give it a size, and that size is limited to 16773100. If I make it a smaller value, reallocating doesn't seem to allow it to have a value larger than the initial definition. I figure my approach is wrong here so any help would be great.
In this example, (just for ease of testing) I made the initial size 10 characters, but I want to add a value that is longer than 10 characters.
dcl-s formattedElement varchar( 100 );
dcl-s gp_SoapMsg pointer;
dcl-s gSoapMessage varchar( 10 ) Based( gp_SoapMsg );
gp_SoapMsg = %Alloc( SOAP_INCREMENT );
formattedElement = 'This is my new test element value';
gSoapMessage += formattedElement;
The contents of gSoapMessage is: 'This is my'
System Development Manager, Service Delivery Platform
From: RPG400-L [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Jon Paris
Sent: Tuesday, November 14, 2017 2:09 PM
To: Rpg400 Rpg400-L <rpg400-l@xxxxxxxxxxxx>
Subject: Re: RPG & Teraspace Storage Model
P.S. If you are just building up a huge string rather than a DS array type structure as described in the article then simply adapt to increment the pointer at the end of each logic block of data that you add. Basically the logic is the same but the value added to the pointer is the variable length of the data just added and not a fixed increment based on DS size.
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,
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives at https://archive.midrange.com/rpg400-l
Please contact support@xxxxxxxxxxxx for any subscription related questions.
Help support midrange.com by shopping at amazon.com with our affiliate link: http://amzn.to/2dEadiD