pTAL Reference Manual (H06.08+)

Built-In Routines
HP pTAL Reference Manual523746-006
15-68
$NUMERIC
$NUMERIC
$NUMERIC tests the right byte of an INT value for the presence of a numeric
character.
int-expression
is an INT expression.
$NUMERIC inspects bits <8:15> of int-expression and ignores bits <0:7>. It tests
for a numeric character according to the criterion:
int-expression >= "0" AND int-expression <= "9"
If a numeric character occurs, $NUMERIC sets the condition code to CCL (condition
code less than). If you plan to test the condition code, do so before an arithmetic
operation or assignment occurs.
If the character passes the test, $NUMERIC returns a -1 (true); otherwise, it returns a 0
(false).
int-expression can include STRING and UNSIGNED(1-16) operands, as
described in Expression Arguments at the beginning of this section.
Example 15-60. $MOVENONDUP Routine
INT .EXT source;
INT .EXT destination;
INT maxword;
INT latestword;
$MOVENONDUP(@destination, @source, maxword, latestword);
pTAL privileged procedure No
Can be executed only by privileged procedures No
Sets condition code No
Sets $CARRY No
Sets $OVERFLOW No
Example 15-61. $NUMERIC Routine
STRING char;
IF $NUMERIC (char) THEN ... ; ! Test for numeric character
( ) ;
VST102.vsd
int-expression
$NUMERIC