I have used a special routine so that to know if code is not getting stuck atleast after 5 tries which is as follows:

If sms[0]="d" and sms[1]="e" and sms[2]="a" and sms[3]="c" and sms[4]="t" then
i=i+1
if i=5 then
while 1
toggle portb.6
pause 100
wend : endif

for c=0 to 12
sum[c+8]=num[c]
next c
for c=0 to 21
serout tx,T2400,[sum[c]]
next c

Serin2 rx,baud,5000,checkms,[WAIT(">")]

Problem is that since I have made the last change of serin2....STR num\13, the code is getting stuck somewhere and not moving at all as it is not entering the toggle loop which it should after waiting 5 times for ">".