How to stop a function and restart the same function from the top?

I have a function that uploads a file to my server via FTP, through a SIM900 modem. If the function determines that it cannot upload the file because of an error (due to whatever reason - bad cell signal or if the modem lost its GPRS connection), I need to exit the function, restart the modem and GPRS connection (there are seperate functions for this), and run UploadCountFile() from the top. When I use break; it does these things but it does not stop the rest of the function after the break command from being executed.

exit(0); and return; does not do what I need here either. What command do I use to do this?

The code below is just the function in question, not necessary to post the whole sketch, right?

 void UploadCountFile()
    {        

        Serial.println(F("<<< SETTING UP FTP UPLOAD OF LAST COUNT FILE... >>>")); 
        while (sendATcommand(F("AT+FTPTYPE=\"A\""), F("OK"), 500) == 0);
        while (sendATcommand(F("AT+FTPSERV=\"ftp.xxx.org\""), F("OK"), 500) == 0);
        while (sendATcommand(F("AT+FTPPORT=21"), F("OK"), 500) == 0);
        while (sendATcommand(F("AT+FTPUN=\"xxx\""), F("OK"), 500) == 0);
        while (sendATcommand(F("AT+FTPPW=\"xxx\""), F("OK"), 500) == 0);       
        Sim900.print(F("AT+FTPPUTNAME=\""));
        Sim900.print(filename);
        Sim900.println(F("\""));
        delay(1000);
        ShowSerialData();
        while (sendATcommand(F("AT+FTPPUTPATH=\"/\""), F("OK"), 500) == 0);         
        Sim900.println(F("AT+FTPPUT=1"));    
        delay(10000);       
        logFile = SD.open(filename);
        delay(2000);
        SizeofFile=logFile.size(); 
        Serial.println();
        Serial.print(F("Filesize for upload = ")); 
        Serial.println((__FlashStringHelper*)SizeofFile);
        getUploadMaxInt(); 
        Serial.print(F("Max size for section upload = "));  
        Serial.println((__FlashStringHelper*)UploadMaxInt);
        FTPSections=(SizeofFile / UploadMaxInt);
        Serial.print(F("Full sections = ")); 
        Serial.println((__FlashStringHelper*)FTPSections);
        
// IF THERE IS AN ERROR, i.e. WHEN FTPSections IS -1, THIS IS WHERE I NEED TO CALL A COUPLE OTHER
// FUNCTIONS, THEN CALL ITSELF (UploadCountFile() ) AND KEEP IT FROM EXECUTING ALL OTHER 
// COMMANDS BELOW THE if (FTPSections < 0) LOOP.

       if (FTPSections < 0)                          
        {
          Serial.println(F("Upload error : restarting MODEM, GPRS and FTP")); 
          ModemReset();
          SetupGPRS();
          UploadCountFile();
          break;           
        }   


        LastSectionSize=(SizeofFile - (FTPSections * UploadMaxInt));
        Serial.print(F("Size of last section = ")); 
        Serial.println((__FlashStringHelper*)LastSectionSize);      
        Serial.println();
        lcd.clear();
        lcd.setCursor(0,0);
        lcd.print(F("UPLOADING FILE:")); 
        lcd.setCursor(0,1);
        lcd.print(F("  ")); 
        lcd.print(filename);     
        for (int i = 0; i < FTPSections; i++)
        {  
            Sim900.print(F("AT+FTPPUT=2,"));
            Sim900.println(UploadMaxInt);
            delay(5000); 
            ShowSerialData(); 
            for (int j = 0; j < UploadMaxInt; j++)
            {                       
              inputChar = logFile.read();
              Sim900.print(inputChar);
            } 
          delay(5000);  
          Serial.println();           
        }
        Sim900.print(F("AT+FTPPUT=2,"));
        Sim900.println(LastSectionSize);
        delay(5000); 
        ShowSerialData();
        for (int k = 0; k < LastSectionSize; k++)
        {
          inputChar = logFile.read();
          Sim900.print(inputChar);
        }
       delay(5000);
       ShowSerialData();  
       while (sendATcommand(F("AT+FTPPUT=2,0"), F("OK"), 5000) == 0);      
       lcd.clear();
       lcd.setCursor(0,0);    
       lcd.print(F("<<SYSTEM BUSY!>>"));       
       lcd.setCursor(0,1);
       lcd.print(F("FILE UPLOADED"));
       smsFileSent();
       logFile.close();
       delay(1000);
       doFTP = false; 
       cls = true;
       Serial.println();
       Serial.println(F("<<< COUNT COMPLETE - WAITING TO READ MORE TAGS... >>>")); 
       batchSize = 0;
    }

THEN CALL ITSELFThis strikes me as a very bad idea. Return an error code and get the calling function to retry, but don't recurse.

Or use "return" on an error condition to exit the function early. You can even use it to exit early out of "loop()".

Paul