how to write a code for receiving message

hello,
please help me in writing the code for receiving a message through gsm modem using at commands

I don't have code to hand but I've seen examples posted here for discussion that do that sort of thing and I'm pretty sure you'll find standard examples that are written for the Arduino compatible 3G shields that show how to do it. In any case, you will certainly find examples showing how to drive a modem using AT commands, and there is plenty of material on the internet about the extended AT command set used to control 3G modems.