It depends on what you want to do.
One way is to check where the camera is, compare it's position to CX and CZ, and then set it to that position if it tries to move past it.
sync on
sync rate 60
hide mouse
autocam off
make matrix 1,1000,1000,25,25
CX=100
CZ=100
CX2=900
CZ2=900
do
move camera (upkey()-downkey())*5
yrotate camera wrapvalue(camera angle y()+((rightkey()-leftkey())*2))
if camera position x() <= CX
position camera CX,camera position y(),camera position z()
endif
if camera position x() >= CX2
position camera CX2,camera position y(),camera position z()
endif
if camera position z() <= CZ
position camera camera position x(),camera position y(),CZ
endif
if camera position z() >= CZ2
position camera camera position x(),camera position y(),CZ2
endif
text 0,0,"Camera X "+str$(camera position x())
text 0,20,"Camera Y "+str$(camera position y())
text 0,40,"Camera Z "+str$(camera position z())
sync
loop
Enjoy your day.