help getting sms parsing working

im using arduino uno with sm5100b module.

#include <NewSoftSerial.h>
#include <String.h>
#include <Wstring.h>
#define BUFFSIZE 512
char c='n';

int bytesread = 0;
int  val = 0;
   

char ATBuff[BUFFSIZE];
char szInPut = 0;
NewSoftSerial cell(2,3);
int CELL_REG = 0;
int CELL_AT = 0;
int CELL_SMSMODE = 0;
int nBufPos;
int msg = 0;
char number[12]; 
char message1[6];
int fog=0;
int fmg=0;
void setup()
 {
  Serial.begin(9600);
  cell.begin(9600);
 

  Serial.println(" ");
  Serial.println("Starting Communication...");

;
 

  }
void loop()
 {

 
 {
      
    while(CELL_REG == 0 || CELL_AT == 0) {  
        ATGetResp();
        ParseATResp();
    }
 
 
   char incoming_ms[20]=" ";
  
  String buff = String(20);
  if(cell.available() >0)
  {
   bytesread = 0;
     while(bytesread=0) {
        val = cell.read();
          
        incoming_ms[bytesread] = val;         // add the digit
        bytesread++;                   // ready to read next digit
         }
         
       }
  int i=0;
  int j=0;
  char incoming_let=0;
  char incoming_char[200]=" ";
  String buff1 = String(200);
  cell.println("AT+CMGF=1");
  
  //cell.println("AT+CMGD=1,4");
  cell.println("AT+CMGL=\"ALL\"");
  delay(450);
 if(cell.available() >0)
  {
   while(cell.available() >0)
    {
     incoming_let = cell.read();
     incoming_char[j]=incoming_let;
     j++;
     }
  }
   buff1=incoming_char;
   
   
if(c=='n')
{
       int l=0;
      
      int flag=0;
      int k=0;
            for(k=0;buff1[k];k++)
            {
                  if(buff1[k]==',')
                  {
                    flag++;
                  }
                  if(flag==3)
                  {
                  if(!(buff1[k]=='"'||buff1[k]==','))
                  {
                  
                  number[l]=buff1[k];
                  Serial.print(number[l]); 
                  l++;
                            
                      
                        }
                  }
                        c='y';
                  if(flag==7)
                  {
                  while(buff1[k]!='"')
                        {
                              k++;
                        }
                        k++;
                  for(l=0;buff1[k]!='\0';l++)
                  {message1[l]=buff1[k];
                  Serial.print(message1[l]);
                  k++;
                  
                       
                        }
                  }      

            
} 
} 

}  

}




void ATGetResp() {
    
    char c;
    memset(ATBuff, '\0', BUFFSIZE);
    
    nBufPos = 0; // start at begninning
    int nBytes = 0;
    
    nBytes = cell.available();
    
    if (nBytes > 0) {
      
      for (int iii = 1; iii <= nBytes; iii++) {
        
        if (nBufPos == BUFFSIZE - 3)
          break;
          
        c = cell.read();
              
        if (c == '\r') {
            ATBuff[nBufPos] = c;
            
            c = cell.read();
        
            if (c == '\n') {

              ATBuff[nBufPos] = '\0';
            
              return;
            }
        }
        
        
        
        ATBuff[nBufPos] = c;
        nBufPos++;
      }
    
    }
        
      ATBuff[nBufPos] = '\0';
      return;
}


void ParseATResp(void) {
        
        if (strstr(ATBuff, "+SIND: 11") != 0) {
            CELL_REG = 1;
          
            return;
        }
        
        
        if (strstr(ATBuff, "+SIND: 4") != 0) {
            CELL_AT = 1;
          
            return;
        }

}

i am having a problem with this code.i am getting result as given below

+CMGL: 1,0,“REC READ”,"+919845600000",“10/12/06,11:12:22+59+00”
Talk na

OK

but when i run with sparkfun example code im getting as given below.

OK
+CMGL: 1,0,“REC READ”,"+919845600000",“10/12/06,11:12:22+00”
Hello
+CMGL: 2,0,“REC READ”,"+919686210008",“10/12/06,11:14:59+00”
Talk na

OK
i need to get +919845600000 and Hello as output.

i am having a problem with this code.i am getting result as given below

but when i run with sparkfun example code im getting as given below.

If the sparkfun example code produced the correct output, but your code does not, one would have to wonder why you don't just go back to the sparkfun example code.

     while(bytesread=0) {

You need == here, not =.

   while(cell.available() >0)
    {
     incoming_let = cell.read();
     incoming_char[j]=incoming_let;
     j++;
     }

What happens if j gets to be larger than 199? You should do some error checking in this loop.

if(c=='n')
{

You have not assigned a new value to c, so, of course this will be true. Useless test.

i need to get +919845600000 and Hello as output.

You store all the incoming data in a String, so parse the string to get the parts you want. If you have trouble doing that, post the parsing code, and we'll help you figure out what is wrong.

i did all the corrections you told.but still im not getting the output.
in sparkfun example code i will have to type manually to get all the messages.

You store all the incoming data in a String, so parse the string to get the parts you want. If you have trouble doing that, post the parsing code, and we’ll help you figure out what is wrong.

my parsing code is simple

+CMGL: 1,0,“REC READ”,"+919845600000",“10/12/06,11:12:22+00”

in this im checking for ‘,’(comma).when i get 3 commas i copy phone number.
code which is given above is working fine for getting number.
and it will be hopefully working fine for getting data also
but my problem is for the first message i read im not getting any data.

+CMGL: 1,0,“REC READ”,"+919845600000",“10/12/06,11:12:22+59+00”
Talk na

i should be getting Hello instead of Talk na.
hope u can find an answer for this.thank you for your kind responses.

i will have to type manually to get all the messages.

You have to type what manually?

Your code indenting is terrible. Your use of white space is awful.

Put each { on a new line. Line the matching } up with it. Indent everything between the braces an equal amount.

Use a single blank line between blocks.

Get rid of { and } that are not needed. If there is no if/while/switch/for statement, or function declaration statement before it, it is not needed.

For now, comment out all parsing code. The first thing you need to do is receive and print all the data.

i am sorry for all the confusions…

#include <NewSoftSerial.h>
#include <String.h>
#include <Wstring.h>
#define BUFFSIZE 512
int bytesread = 0;
int  val = 0;   
NewSoftSerial cell(2,3);
void setup()
 {
  Serial.begin(9600);
  cell.begin(9600);
  Serial.println(" ");
  Serial.println("Starting Communication...");
  delay(500);
  
  }
void loop()
 {
 
    
    
  char incoming_ms[20]=" ";
  String buff = String(20);
  if(cell.available() >0)
                        {
                           bytesread = 0;
                             while(bytesread==0)
                               {
                                val = cell.read();
                                incoming_ms[bytesread] = val;         // add the digit
                                bytesread++;                   // ready to read next digit
                               }    
                         }
  int i=0;
  int j=0;
  char incoming_let=0;
  char incoming_char[500]=" ";
  String buff1 = String(500);
  cell.println("AT+CMGF=1");
  cell.println("AT+CMGL=\"ALL\"");
  delay(450);
                        if(cell.available() >0)
                          {
                             while(cell.available() >0)
                              {
                               incoming_let = cell.read();
                               incoming_char[j]=incoming_let;
                               j++;
                              }
                           }
   buff1=incoming_char;
 Serial.println(buff1);
 
 }

i did sort out the problem

OK
+CMGL: 1,0,“REC READ”,"+919845607360","10/12/06,18:49:50+

thats my problem
its not reading any data.

i got to know the problem.can anyone tell me how much delay should i put?i am using arduino uno board.

thank you.