You can return values to calling programs in RPG. RPG PARM Details.
If you have a subroutine for checking leap year that you want to use often, you could incorporate this module into a service program which you could use from your other programs, or as a module that you could bind when you need it.
Hope this helps,
If a program is called with a parameter list (*ENTRY/PLIST), the program can (usually) simply change the value of a parameter. When the called program ends, the calling program will see that the parameter variable has a new, changed value.
Programs are called with parameters ‘by reference’ by default, rather than ‘by value’.