OpenEdge 11.6 - Error Message | Unable to allocate memory fo

Posted by atuldalvi123 on 09-May-2019 14:55

Hello All,

Any idea on the error "Unable to allocate memory for token array. (9104)"  ?

I am creating couple of temp tables with data and calling one common procedure in the same program to assign those table field data to a LONGCHAR  variable.

I think longchar variable is not capable to handle all the data and so the error is but not sure.

Code sample -

PROCEDURE writeTableToOutput:
  
  DEFINE INPUT        PARAMETER ipcTableName   AS CHARACTER   NO-UNDO.
  DEFINE INPUT        PARAMETER ipcQueryString AS CHARACTER   NO-UNDO.
  DEFINE INPUT-OUTPUT PARAMETER ioplcOutput  AS LONGCHAR    NO-UNDO.
 
  DEFINE VARIABLE icounter  AS INTEGER NO-UNDO.
 
  DEFINE VARIABLE hbufTable AS HANDLE      NO-UNDO.
  DEFINE VARIABLE hQuery    AS HANDLE      NO-UNDO.
 
  CREATE BUFFER hBufTable FOR TABLE ipcTableName.
  CREATE QUERY hQuery.
  hQuery:ADD-BUFFER(hBufTAble).
  hQuery:QUERY-PREPARE(ipcQueryString).
  hQuery:QUERY-OPEN().
  REPEAT:
          hQuery:GET-NEXT().
          IF hQuery:QUERY-OFF-END THEN LEAVE.
          

          ioplcOutput = SUBSTITUTE("&1[&2]&3&4", ioplcOutput , SUBSTRING(ipcTableName,3,LENGTH(ipcTableName)),CHR(13),CHR(10)).


          DO icounter = 1 TO hbufTable:NUM-FIELDS:
            ioplcOutput = SUBSTITUTE("&1&2|",ioplcOutput , hbufTable:BUFFER-FIELD(icounter):buffer-value ).
          END.


          ioplcOutput = SUBSTITUTE("&1&2&3",ioplcOutput,CHR(13),CHR(10)).


  END.

  DELETE OBJECT hBufTable.
  DELETE OBJECT hQuery.


END PROCEDURE.

Any alternative for this ?

Thanks in advance.

All Replies

Posted by OctavioOlguin on 10-May-2019 14:02

Create a temp-table with just a a key filed and a BLOB o CLOB field, and move your legthy values using that field and COPY-LOB statements...

I've been there before.n

Posted by Ruanne Cluer on 10-May-2019 14:08

A LONGCHAR data types is 1GB (one gigabyte)

Error 9104 itself is a compiler error, not a runtime error

It is most likely occuring on the

**  hQuery:QUERY-PREPARE(ipcQueryString).

A debug listing may help:

COMPILE <program-name>.p DEBUG-LIST debug.lst

How many fields are in the temp-table?

What -tok value are you using, or is it the 3000 default tokens?

Does your –inp (the size of the input string) have enough room for the statement?

This thread is closed