I agree, however, I was trying to explain, In the normal sense (programming in most languages), however, PLC mfg seem to do their own thing and not follow the rules. anyway, many years ago I created a function block in an SLC, and before you say it is not possible in a roundabout way it is. Here is the explanation.
I had an SLC505 system that collected data from 14 production lines both using communication and digital I/O (mainly for the ones that I could not modify i.e. sensors & digital signals added to the machines to gather data).
The idea was to grab data like machine running/stopped time, line speed, pack counts, packs per min, rejects etc and send the data to each display above the lines, this consisted of 14 displays that would display this for each line.
It became apparent that to convert the data into an ascii string & send this to each display would take up so much code that it would run out of space, the answer was to create a standard block of code that took the data, converted it into the ascii string with headers, footers & checksum & send it to the coms card.
to do this I allocated an area of an integer file to use as a scratchpad so this area became the input & output variables in the function block.
So for example the input variables would be N7:50 to N7:59 and the output variables were N7:60 to N7:69.
I created a program file that used these variables to do the required conversion to ascii & generate the headers/footers, check sum etc.
then in the main program before calling the block I would transfer the values from the variables to the temps and then call the program block and then transferring the out variables back to the main program, this was done 14 times by polling i.e. a counter that was triggered on a com send complete.
Attached is a simple way of doing this in RSL note: this is just a simple idea and would not be practicable as it takes more code to pass the variables and call the function than actually doing it long hand, however, it shows the principal. so basing it on the simple add function in an earlier post in the main prog lad 2 it passes data from N7:0 to N7:2 to the temps N7:50 to N7:52 jumps to LAD 6 this does the calc & on return from the subroutine returns the result from N7:53 to N7:3 on the first call and N7:7 on the second.
You can see from this it is possible to create a standard (AOI) although a bit of a pain it means on a complicated function it could save program memory and a lot of typing or copy/paste etc.
As I said earlier, this is just a simple example to demonstrate it working but by the use of indirect addressing etc and a need for a complex function it will work on older types of PLC's that have program block control but no function blocks.
And before someone comes up with scan time, the way the (FB) was called conditionally in the one I did some years ago the call was conditional on completing the com before it called the block again so probably only called the block every few scans. After all this is exactly how the compiler will produce the code by passing the variables to/from the blocks own variables.
Incidentally, although I did not calculate the memory saved but when I originally did the project I estimated it saved between a half and two thirds of the required memory compared to long hand coding.