MATH_NUMERIC Data Type

The MATH_NUMERIC data type is commonly used to represent numeric values in JD Edwards EnterpriseOne software. This data type is defined as follows:

struct tag MATH_NUMERIC

{
   ZCHAR String [MAXLEN_MATH_NUMERIC + 1];
   BYTE  Sign;
   ZCHAR EditCode;
   short nDecimalPosition;
   short nLength;
   WORD  wFlags;
   ZCHAR szCurrency [4];
   Short nCurrencyDecimals;
   short nPrecision;
};

typedef struct tag MATH_NUMERIC MATH_NUMERIC, FAR *LPMATH_NUMERIC;

This table shows math-numeric elements and their descriptions:

MATH_NUMERIC Element

Description

String

The digits without separators

Sign

A minus sign indicates the number is negative. Otherwise, the value is 0x00.

EditCode

The data dictionary edit code used to format the number for display

nDecimalPosition

The number of digits from the right to place the decimal

nLength

The number of digits in the String

wFlags

Processing flags

szCurrency

Currency code

nCurrencyDecimals

The number of currency decimals

nPrecision

The data dictionary size

When assigning MATH_NUMERIC variables, use the MathCopy API. MathCopy copies the information, including Currency, into the location of the pointer. This API prevents any lost data in the assignment.

Initialize local MATH_NUMERIC variables with the ZeroMathNumeric API. If a MATH_NUMERIC is not initialized, invalid information, especially currency information, might be in the data structure, which can result in unexpected results at runtime.

/*************************************************
 * Variable Definitions
 *************************************************/
   MATH_NUMERIC   mnVariable  = {0};

/************************************************
 * Main Processing
 ************************************************/
   ZeroMathNumeric( &mnVariable );
   MathCopy( &mnVariable,
             &lpDS->mnVariable );