You are here: Development Standards > Upgrading OSAS > OSAS 4.5x Upgrade Procedure > Implement User-Defined Numeric Masking

# Implement User-Defined Numeric Masking

Programs that deal with numeric values should be converted to use the numeric masking defined by the user in the Resource Manager Company Information function.

Users can define the precision of several numeric types: dollar amounts, quantities, unit prices, unit costs, hours, rates and credit limits. These numeric fields have a 14-character mask, which Resource Manager builds for you. The precisions and masks are stored in global string variables as follows:

Number Type | Mask | Precision
Regular dollar amounts | "+DOLL" | "-DOLL"*
Quantities | "+IQTY" | "-IQTY"
Unit prices | "+INUP" | "-INUP"
Unit costs | "+INUC" | "-INUC"
Hours | "+HOUR" | "-HOUR"
Rates | "+RATE" | "-RATE"
Credit Limits | "+CRED" | "-CRED"
GL dollar amounts | "+GDOL" | "-GDOL"*
GL dollar amounts with commas | "+GCOM" | "-GCOM"*

*Regular dollars and GL dollars always have the same precision.

Note: Some numeric fields can be of hard-coded precision according to the needs of the program (for example, variance percentages) and are not defined by the user.

Follow these steps to implement the preferred method for handling these variable precisions:

1. Determine the precisions required by the program based on the numeric types used in the program and assign them to variables. For example, in a program that includes dollar amounts and quantities
   `LET DPREC=NUM(STBL(“-DOLL”))`
   `LET QPREC=NUM(STBL(“-IQTY”))`
2. Determine the maximum precision required by these numerics using
   `LET MPREC=MAX(DPREC,QPREC)`
3. Because PRECISION is reset when a program is RUN, set the maximum precision at the beginning of each program in the chain:
   `PRECISION MPREC`
4. Use the ROUND() function when performing multiplication or division tasks, including any BBx functions that involve multiplication or division, such as INT(), FPT() or MOD():
   `EXTPRICE=ROUND(UNITPRICE*QUANTITY,DPREC)`