The environment I chose to create for a "Fresh Start" is a library named ILESAMPLE.
First, I created the library:
Next, I created the source physical files:
CRTSRCPF FILE(ILESAMPlE/QRPGLESRC) RCDLEN(112)
CRTSRCPF FILE(ILESAMPlE/QMODSRC) RCDLEN(112)
CRTSRCPF FILE(ILESAMPlE/COPYSRC) RCDLEN(112)
The four source physical files I am created are as detailed as the following:
Now if you're already confused, don't be. Things will make more sense as we go through the examples.
But, the first glaring issue would be the terms Module and Service Program. I'm sure you've heard them before, and maybe even asked about them only to be more confused as to the difference, and when to use each one. But, for now, just think of things this way:
You create a Module which contains the subprocedures (or functions). This Module can be bound "by copy" to your programs so the subprocedures within can be used. This means a physical copy of the module is added to the program.
A Service Program is created from a Module. Think of a Service Program as a "Stand Alone" copy of the Module. In other words, when you use the subprocedures within a service program it's like calling a separate program on your system.
The call to a subprocedure for a Module and a Service Program will look exactly the same. The only difference will be that the Service Program will be on it's own, and a Module must be "Bound" to the program.
Again, this will make more sense once we get into the gritty details, so lets get started with our first module.