Shell Script Function

Dear Friends,

I am on SOLARIS 9 (ksh)

I am working on a shell script that upload files with NcFTP with resume option. So far the script is working correctly. The script makes a list of files that need to be transferred and then launch the NcFTP command to start the transfer.

My problem is while creating the FLAG to say that the FTP transfer is OK. So far I need to restart once more the shell script to check if a difference exist between the local list and the files already transferred. If the local list = the list of the files transferred the FLAG is created and send to the remote server.

My idea is to write a function that will create this FLAG (If the transfer is completed) and send it at the ends of the transfer without to running twice that script.

I know I could change the position of the : if , then , else condition but I would go first with the function if possible of course.

Any idea about how to write this function and how to call it ?

Thanks for your help