9.16 CHECKNUMERIC
Checks a string only contains allowable values and converts the digital and decimal portions into numeric variables.
Arguments
No | Type | Req/ Opt | Description | Min Len | Max Len | Min Dec | Max Dec |
|---|---|---|---|---|---|---|---|
1 | A | Req | String to be converted | 1 | 256 | ||
2 | N | Opt | Max. no. of integers allowed Range: 0 - 63 Default: 15 | 1 | 3 | 0 | 0 |
3 | N | Opt | Max. no. of decimals allowed Range: 0 - 63 Default: 9 | 1 | 3 | 0 | 0 |
4 | A | Opt | List of allowable characters to be ignored e.g. $, %, C, R | 1 | 50 |
Return Values
No | Type | Req/ Opt | Description | Min Len | Max Len | Min Dec | Max Dec |
|---|---|---|---|---|---|---|---|
1 | N | Req | Return integer portion | 1 | Unlimited | 0 | 0 |
2 | N | Opt | Return decimal portion | 1 | Unlimited | 1 | Unlimited |
3 | A | Opt | Return okay code (Y/N) | 1 | 1 | ||
4 | A | Opt | Return sign of the number (+ or -) | 1 | 1 | ||
5 | N | Opt | Return number of integers | 1 | 3 | 0 | 0 |
6 | N | Opt | Return number of decimals | 1 | 3 | 0 | 0 |
Example
To get a packed decimal 9,2 result field #P92 from an alphanumeric field #A using 2 intermediate work fields called #P90 and #DEC.
USE BUILTIN(CHECKNUMERIC) WITH_ARGS(#A 7 2) TO_GET(#P90 #DEC)
CHANGE FIELD(#P92) TO('#P90 + #DEC')