Good News Everybody!
The new search engine is LIVE!
Please report any problems to david (at) midrange.com.
|
All, I'm having a problem with using REALLOC (and its equivalent %REALLOC): It's exactley the same as David Mosrris mentioned in this thread: http://archive.midrange.com/rpg400-l/199802/msg00001.html Essentially, I'm processing a binary tree where every tree item has the following structure: D Item DS Based(Item@) D From@ * D Left@ * D Right@ * D Data@ * and where I also have the following field: D ItemData S 32757A Varying Based(ItemData@) As I add elements to the tree (elements are Varying data strings up to 1000 bytes long, with the first 20 characters being a key), I check if an item already exists with the same key. If not, I add a new item, otherwise I overwrite the existing item's data with the new data. The processing to add/update data is as follows (where InString is the new data string): C Eval VLen = %len( InString ) + 2 * * Store item data * C If Data@ <> *Null C Eval Data@ = %realloc( Data@ : VLen ) C Else C Eval Data@ = %alloc( VLen ) C Endif * C If Data@ = *Null C Exsr *PSSR C Endif * C Eval ItemData@ = Data@ C Eval ItemData = String Now all the %alloc's work fine, as does the first %realloc. However, subsequent %realloc's fail with a CEE0810 ("The starting address for reallocation is not valid."). However, I've done all the %alloc's/%realloc's... What am I missing? I'm on a V5R2 box, compiling back to V5R1, but this also seems to fail at V5R2. TIA, Rory
This mailing list archive is Copyright 1997-2026 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.