urgently ,i want to delet all massages stored on SIM using GSM shield.

hello guys.

iam using arduino uno and GSM shield .i'm very new to arduino. i wrote a code to send and receive sms's using GSM library. but i have to delete all the massages after some time as when it reaches a certine limit it stops receiving . sms.flush(); delets only the sent massages. after alot of reading i found that AT command "AT+CMGD=1,4" can delete all massages sent or received. the problem is i don't know how to combine it in my code??? .alot say connect the shield directly to serial .i can't it is connected through it's pins on the Uno as daughter board.
please tell me how to add this AT command in my code urgently.

part of my code:
void setup() {
//Setup for SMS recieving. Serial setup makes it possible to monitor the status on your PC while connected
// Serial.println("SMS Recieving");


boolean notConnected = true; // this defines a variable that indicates no GSM connection if true
while(notConnected) { // if there is no connection, the program runs gsmAcess. gsmAcess returns GSM_READY when connected
if(gsmAccess.begin(PINNUMBER)==GSM_READY) // If you have a PIN number on your SIM card, write it as parameters here in quotes. PINNUMBER"9876"
notConnected = false;
else {
//messages printed on the serial monitor
Serial.println("No connection");
// if connection is established
Serial.println("GSM connected"); //GSM connected
Serial.println("Waiting"); //Waiting for SMS