jBASE : BITTEST Function

21 views
Skip to first unread message

Road Jogger

unread,
Feb 8, 2010, 9:26:00 AM2/8/10
to jB...@googlegroups.com
Hi All,
 
The function BITTEST doesnt seem to work even though its defined in the manual..... I have a very simple program....
 
PROGRAM TEST1
 
$INSERT I_COMMON
$INSERT I_EQUATE
*
PRINT BITTEST(11, 0)
PRINT BITTEST(11, 1)
*
RETURN
STOP
 
When I compile this routine, it gives me an error that BITTEST is an assumed DIMENSIONED ARRAY..... but no DIM statement was found.
 
jBASE Release : jBASE 5.0 Minor 21
AIX Version : 5.3
Kernet Type : 64 Bit....
 
Basically we are converting our database from Universe from jBASE.... and BITTEST was used in universe....
 
If BITTEST is not used in jBASE, then whats the equivalent of the same....
 
Regards,
Nara

pat

unread,
Feb 8, 2010, 2:33:11 PM2/8/10
to jBASE
The 'BITTEST' functionality can be provided by the following simple
Basic function :

FUNCTION BITTEST(var1,var2)

IF BITAND(var1,( 2 ^ var2)) THEN
RETURN (1)
END ELSE
RETURN (0)
END


Create the above Basic source item, called ( say ) 'BP BITTEST'

Compile and CATALOG 'BP BITTEST', eg :

BASIC BP BITTEST

CATALOG BP BITTEST

Add a :

DEFFUN BITTEST(a,b)

line to your test program, eg :

DEFFUN BITTEST(a,b)
CRT BITTEST(11, 0)
CRT BITTEST(11, 1)

[ The Globus Includes 'I_COMMON' and 'I_EQUATE' are NOT required in
your test program ]

Compile and CATALOG your test program

Hope this helps,

Pat.

Reply all
Reply to author
Forward
0 new messages