ENT 

Structuring User-Defined Functions

A user-defined function definition is a stand-alone compilation unit that may not be nested within other compilation units. It must appear within the compilation group before the programs and functions that invoke them.

Compilation group syntax

Compilation Group syntax
Note: You cannot invoke a user-defined function from a separate program object.