Contents - Index


 

Use VarTestNumeric to test the value of a specified variable to determine whether it is numeric.

 

VarTestNumeric may also be entered as VarTestNum[eric] or VTestNum[eric].

 

Required Operands

 

OBJ is the name of a previously declared character variable.

 

Return Codes

 

OK Characters are numeric.

NU Characters are not numeric.

 

Examples

 

Procedure for a single function calculator:

 

 ------------------------------------------------------------------------

 SET PPDVBL,1

 DCL MULT1,CHAR,8,V

 DCL MULT2,CHAR,8,V

 DCL PROD,NUM,8,V

 DCL MSG,CHAR,80,V

 LABEL LOOP

 MAPF

   MULTIPLY MULT1    X MULT2   

  &MSG

 ++/*

 SET PPDCOND,1

 SET MSG,'** NOT NUMERIC **'

 VTESTNUM MULT1

 IF SIBRETCD EQ OK

   VTESTNUM MULT2

 IF SIBRETCD NE OK

   GOTO -LOOP

 SET PPDCOND,0

 SETD PROD,MULT1

 MULTIPLY PROD,&MULT2

 IF PROD EQ 0

   EXIT OK,'PRODUCT IS ZERO -- NORMAL END'

 SET MSG,'PRODUCT IS &PROD'

 GOTO -LOOP

 ------------------------------------------------------------------------