Residence Visa cancellation in qatar

I got a job in dubai and my employer in dubai wanted me to cancel my visa in qatar (Residence visa with work permit), So my question is how long can i stay in qatar after cancelling my Visa in qatar?(as my Dubai employer will start the visa processing only after my qatar visa is cancelled)and my second question is that after cancelling my qatar visa is there any rule like i must to exit to india itself(i am an indian)or can i go directly to dubai with my dubai visa?