read a file and use the content for mapping

help me pls.. :frowning:
i want to read a mapping file.
Below is the content of my mapping file.

6221,189,SMSC1,OMC1,WAP1
6223,188,SMSC2,OMC2,WAP2

so when my program running

msisdn="622130302310"
while not EOF
if substring($msisdn,1,4) == "6221" -- > "6221" read from the file
then
echo "$msisdn,189" > TEMPFILE -- > "189" read from the file
ftp TEMPFILE to SMSC1
ftp TEMPFILE to OMC1
ftp TEMPFILE to WAP1
end if
end while

what is the solution of my problem?

thanks before hand.