Ckick ok give the program details (like if you create a new program). The code is created and ready for you to test. See the following screen shot.
Now you can execute the code or alter the code as you like. If you run the code it will look like as follows.
Once the above Read from File is selected the code generated has open data set and read data set and close data set and if you run the code it looks like as follows. You have a place to mention a file. See the following screen shot.
Creating a Fucntion Module:
Use the same way instead of program click on the function module that will create a function module. You can convert the function module as RFC so that the external system can call and input the data. If XI/PI has a file we usually create a RFC or proxy and process the data.
The following links are reference that I used
Hope this helps.