Consultor Eletrônico



Kbase P163263: 4GL/ABL: Error 2922 invoking the ABL SUBSTITUTE function with a CHARACTER variable or a preprocessor
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   10/15/2010
Status: Unverified

SYMPTOM(s):

4GL/ABL: Error 2922 invoking the ABL SUBSTITUTE function with a CHARACTER variable or a preprocessor-name base-string and LONGCHAR argument

Out of stack space for SUBSTITUTE processing. (2922)

Invoking the ABL SUBSTITUTE function with a CHARACTER variable or a preprocessor-name base-string and a LONGCHAR argument generates the above error if the result returned by the function exceeds the 32K CHARACTER variable size limit.

This code snippet generates the error invoking the ABL SUBSTITUTE function with a CHARACTER variable base-string if the result returned by the function exceeds the 32K CHARACTER variable size limit:
DEFINE VARIABLE btext AS LONGCHAR NO-UNDO.
DEFINE VARIABLE etext AS LONGCHAR NO-UNDO.
DEFINE VARIABLE dataPattern AS CHARACTER NO-UNDO INIT '<Data>&1</Data>'.
COPY-LOB FROM FILE "Bug.txt":U TO btext .
ASSIGN
etext = SUBSTITUTE( dataPattern, btext ).

This code snippet generates the error invoking the ABL SUBSTITUTE function with a preprocessor-name base-string if the result returned by the function exceeds the 32K CHARACTER variable size limit:
DEFINE VARIABLE btext AS LONGCHAR NO-UNDO.
DEFINE VARIABLE etext AS LONGCHAR NO-UNDO.
&SCOPED-DEFINE dataPattern "<data>&1</data>"
COPY-LOB FROM FILE "Bug.txt":U TO btext .
ASSIGN
etext = SUBSTITUTE ( {&dataPattern}, btext ).


FACT(s) (Environment):

All Supported Operating Systems
OpenEdge 10.2B

CAUSE:

Bug# OE00196820

FIX:

Upgrade to OpenEdge Release 10.2B02 or later

FIX:


A workaround for the first case is to change the definition of the base-string variable,dataPattern, from CHARACTER to LONGCHAR data type when the returned result is expected to exceed the 32K CHARACTER variable size limit. For example:
DEFINE VARIABLE btext AS LONGCHAR NO-UNDO.
DEFINE VARIABLE etext AS LONGCHAR NO-UNDO.
DEFINE VARIABLE dataPattern AS LONGCHAR NO-UNDO INIT '<Data>&1</Data>'.
COPY-LOB FROM FILE "Bug.txt":U TO btext .
ASSIGN
etext = SUBSTITUTE( dataPattern, btext ).
A workaround for the second case is to assign the value of the preprocessor-name base-string to an intermediate LONGCHAR variable and invoke the SUBSTITUTE function using that intermediate LONGCHAR variable as the base-string instead of the preprocessor-name. For example:
DEFINE VARIABLE btext AS LONGCHAR NO-UNDO.
DEFINE VARIABLE etext AS LONGCHAR NO-UNDO.
DEFINE VARIABLE lcTmp AS LONGCHAR NO-UNDO.
&SCOPED-DEFINE dataPattern "<data>&1</data>"
COPY-LOB FROM FILE "Bug.txt":U TO btext .
ASSIGN
lcTmp = {&dataPattern}
etext = SUBSTITUTE ( lcTmp, btext ).