Consultor Eletrônico



Kbase P127714: Function return value overrides number of decimals in variable definition
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   12/19/2007
Status: Unverified

FACT(s) (Environment):

All Supported Operating Systems
OpenEdge 10.1x
OpenEdge Category: Language (4GL/ABL)

SYMPTOM(s):

Function return value overrides number of decimals in variable definition

Variable defined with a specific number of decimal places, e.g.


def var hDec as dec format ">>9.999999" decimals 2 no-undo.

A called function returns a decimal variable with a different number of decimal places, e.g.


FUNCTION fTest RETURNS LOGICAL (OUTPUT p as DEC ):

Calling a function and assigning the return value directly to the variable in the function call, e.g.

fTest(OUTPUT hDec).

After the function call the variable contains more decimal places than is specified in its original definition.

The function output parameter definition has overridden the variable definition.

CAUSE:

This is a known issue

FIX:

As a work around assign the return value to an intermediate variable, for example:

DEFINE VARIABLE d1 AS DECIMAL NO-UNDO.

fTest(OUTPUT d1).
hDec = d1.