Code not showing Values on Second input

just to convert it to a number. Interesting technique.

actually this is NOT TO JUST HAVE A number the p stands for pan and r and small L stands for right and left pan movement , when the comes it makes sure to drive that condition only that will put analogWrite PWM values to turn it right but on a specific PWM speed ,all these values are received over XBee pro and it seems to work well with this sketch TOTALLY FINE untill i got those Speed PWM functioning in there, Still the TILT of the BASCOR PAN TILT works very very fine so i DO not think the resetting of started and ended is needed(if definitely needed please tell some detailed viewpoint)

TOTALLY FINE WORKING SKETCH:

char inData[20]; // Allocate some space for the string
char inChar = 0; // Where to store the character read
int index = 0; // Index into array; where to store the character
int slaveSel = 0;
String Data;
int intData, pan;
boolean started, ended, panTimer;
long previousMillis = 0; 
long interval = 2420;
int pan1 = 9;
int pan2 = 6;
int tilt1 = 5;
int tilt2 = 3;

void setup() 
{
  pinMode(13, OUTPUT);
  pinMode(pan1, OUTPUT);
  pinMode(pan2, OUTPUT);
  pinMode(tilt1, OUTPUT);
  pinMode(tilt2, OUTPUT);
  Serial.begin(9600);  
  for (int pinNumber = 3; pinNumber <= 7; pinNumber++)
  {//function to read a jumper out of 5 jumpers 
       pinMode(pinNumber, INPUT); 
       if (digitalRead(pinNumber)==1) {
          slaveSel = pinNumber;
       }
  }
}
void loop() 
{
while(Serial.available() > 0) // Don't read unless
    // there you know there is data
  {
      inChar = Serial.read(); // Read a character//read the character
      if(inChar =='<') //not sure what to put in if statement to run until end
      {
        started = true;
        index=0;
      }
      else if(inChar =='>')
      {
        ended = true;
        break;
      } 
      if(started)
      { 
       inData[index] = inChar; // Store it
       index++; // Increment where to write next
       inData[index] = '\0'; // Null terminate the string    
      }
  } 
  if (ended) 
  {
      Data = inData;//values of acclerometer like "545X" etc enter and stored in Data

      char CharData = Data.charAt(6);//Taking the 4th last character from extreme Right and storing in CharData to check for AXIS
      intData = int(CharData);
      if (intData == slaveSel) 
      {  
        digitalWrite(13, HIGH); 
      }
      if (bitRead(PORTB, 6)){
        //process();
      }
  }
  process();
}

void process() 
{
       Data = Data.replace('<', ' ');
       Data = Data.replace('>', ' ');
       Data = Data.trim();
   if (Data == "panCLKwise")//Here put the condition as per the values received from the Accelerometer
       {
         if (panTimer == true) pan=0;  else panTimer = true;
         digitalWrite(pan1,HIGH);
         digitalWrite(pan2, LOW);
         Serial.println(Data);
         Serial.println(millis());
         for(int i=0;i<10;i++)
         {
           inData[i]=0;
         }
         index=0;
         intData = 0;
         Serial.flush();        
       } 
   if (Data == "PANSTOP") {
         digitalWrite(pan1, LOW);
         digitalWrite(pan2, LOW);
         Serial.println(Data);
         for(int i=0;i<10;i++)
         {
           inData[i]=0;
         }
         index=0;
         intData = 0;
         Serial.flush();   
       }      
   if (Data == "panACLKwise")//Here put the condition as per the values received from the Accelerometer
       {
         if (panTimer == true) pan=0;  else panTimer = true;
         digitalWrite(pan1,LOW);
         digitalWrite(pan2, HIGH);
         Serial.println(Data);
         Serial.println(millis());
         for(int i=0;i<10;i++)
         {
           inData[i]=0;
         }
         index=0;
         intData = 0;
         Serial.flush();        
       } 
         
       if (panTimer == true) {
         unsigned long currentMillis = millis();
         if(currentMillis - previousMillis > interval) {
         
          previousMillis = currentMillis;   
          pan++;
          if (pan == 7) {
             digitalWrite(pan1, LOW);
             digitalWrite(pan2, LOW);
             panTimer == false;
             pan = 0;
          }
        }
       }
}