Consultor Eletrônico



Kbase P123839: The LENGTH function returns 0 for variables with space values.
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   11/05/2007
Status: Unverified

FACT(s) (Environment):

OpenEdge 10.1x

SYMPTOM(s):

The LENGTH function returns 0 for variables with space values.

The FORMAT of a variable seems to affect the LENGTH function if the variable contains spaces.

LENGTH function returns 0 for variable with value " "

After upgrading to OpenEdge 10.1x, the LENGTH function does not return the correct length for variables that contain only spaces.

DEFINE VARIABLE c1 AS CHARACTER FORMAT "X" INITIAL " ".
DEFINE VARIABLE c2 AS CHARACTER INITIAL " ".
DEFINE VARIABLE c3 AS CHARACTER FORMAT "X" INITIAL " ".
c3 = " ".
DISPLAY LENGTH(c1) LENGTH(c2) LENGTH(c3).

This code will result in "0 1 1".

CHANGE:

Upgraded from OpenEdge 10.0B.

CAUSE:

This is a known issue being investigated by Development

FIX:

As a work around, assign the variable a space after its definition. For example:

c3 = " ".