Modules are the basic building blocks of programs and service programs. Generally one module contains the whole program and has no more than 3000 lines. I have a soft limit of 2500 lines. But that really depends what I am programming. Embedded SQL seems to take up more lines because of the error handling.

If a module grows too big or covers multiple domains I split it into multiple smaller modules. One module should cover one domain.

I have read sometimes that some developers limit their modules to one procedure per modules. But that doesn’t make sense. Related procedures should be grouped in modules.