iSeries / AS400 FAQ : Programming : RPG : How can I get started with subprocedures?
Q. I would like to get started using sub-procedures, but it looks like there is a lot to have to understand all at once. Is there a primer for beginners? My primary interest is in avoiding knowing any more about a procedure than the function and the parm(s). I have a strong desire to NOT know who is maintaining the code, etc. I don’t really even want to look inside the code. A. That is the whole point of procedures (at least those procedures intended for general consumption via the public interface of a service program). All that the consumer of the function needs to know should be apparent from the prototype. For example, call function A passing X, Y, and Z and receive R as a return value. The consumer does not, and should not, care how the procedure does its stuff–only that it does. Procedures used in this way are black-box building blocks from which a more complex application can be built. Private procedures (i.e.
Q. I would like to get started using sub-procedures, but it looks like there is a lot to have to understand all at once. Is there a primer for beginners? My primary interest is in avoiding knowing any more about a procedure than the function and the parm(s). I have a strong desire to NOT know who is maintaining the code, etc. I don’t really even want to look inside the code. A. That is the whole point of procedures (at least those procedures intended for general consumption via the public interface of a service program). All that the consumer of the function needs to know should be apparent from the prototype. For example, call function A passing X, Y, and Z and receive R as a return value. The consumer does not, and should not, care how the procedure does its stuff–only that it does. Procedures used in this way are black-box building blocks from which a more complex application can be built. Private procedures (i.e., those that exist within a program or those that are not part of the