Hi Gongura,
If the function is intended to be used frequently in the pgm, I'd take both your approach and CL's approach and look at the generated assembler code or time each approach to determine which is faster.
To get the generated assembler language insructions listed in the compiler O/P, include options LIST,NOOFF as well as any others you may need.
I suspect that CL's would be more efficient, but a test would prove (or disprove) it.
Regards, Jack.