You are here: Development Standards > Routines > General Routines > GENNUM

# GENNUM

GENNUM is a general routine that contains two multiline functions called FNNUM$ and FNGUINUM$. These functions take a numeric value and a mask and return a string containing the masked numeric value. FNGUINUM$ also sets a mask for an INPUTN control. GENNUM occupies lines 10000–10099 and should be merged into all programs that display or print numeric values.

Variable | Description
XX3 | Any numeric value to format
XX1$ | The numeric mask to use
ID (FNGUINUM$ only) | A GUI control ID in which the mask and data should be set

To use GENNUM, substitute FNNUM$(XX,XX1$) for the old XX:XX1$ logic in screen display or report printing. For example, to print the variable A6 to the screen using the mask in M1$,

`7720 PRINT @(22,10),FNNUM$(A6,M1$),`

instead of

`7720 PRINT @(22,10),A6:M1$,`

In GUI mode, the above code would look like the following:

`17720 PRINT (OSGUI.CHAN)’TITLE’(4010,FNGUINUM$(A6,M1$,4010)`

This would set the mask M1$ as the current mask for control ID 4010, and also display the data to the control.

If the value of A6 is too large to fit the mask, the function returns asterisks (*) to the length of the mask, providing protection against error 43s. For GUI screens, asterisks will not be displayed. Error 43s will still be protected against in GUI mode, but the control will be filled with spaces rather than asterisks.