Below is an example of how to use a subroutine in a CATIA V5 macro:

Download more CATIA V5 macros here.