[Info-vax] Is this a Bug ?

StGallen sengupta.suhas at gmail.com
Tue Apr 17 04:58:40 EDT 2012


Dear All

VMS 7.3-1
DEC Basic 1.4

I have a situation where I need to check if the integer part of a decimal number is > 0. The number could be upto 999999999999.999999. Thus, I need to check if the integer part 999999999999 is greater than 0.

INTEGER(sNum,LONG) works but throws 52 - Illegal Number since the LONG cannot handle a number this big. My alternative was to use QUAD. 
This gives me BAS-F-MEMMANVIO, Memory management violation

Refering to the BASIC manual, I have added: option handle = severe
Also I have compiled with the /CHECK qualifier.

Any ideas are most gratefully welcome.



10
        option handle = severe

%include "STR$ROUTINES" %from %library "sys$library:basic$starlet"
%include "$lnmdef"      %from %library "sys$library:basic$starlet"
%include "$libclidef"   %from %library "sys$library:basic$starlet"


DECLARE STRING sNUM
DECLARE STRING sPI
DECLARE STRING sPF
DECLARE LONG lSTAT
sPI = ""
sPF = ""

LINPUT "Enter a number  ";sNUM
lStatus =  STR$ELEMENT(sPI,0,".",sNUM) ! Integer part
lStatus =  STR$ELEMENT(sPF,1,".",sNUM) !fractional part

 IF INTEGER(sPI,QUAD) = 0 !<---- program aborts here
 THEN
    PRINT "INT part is 0"
 ELSE
        PRINT "INT part is ";INTEGER(sPI,QUAD)
 END IF
32767 END



More information about the Info-vax mailing list