have you tried it as *DEC (n n) where n n is the length and number of decimal places?
A QM query can’t return a value to CL. CL can’t call stored procs. Some different process needs to be developed. Actually, it seems to be a very long way around what should be simple. CL can call programs directly or it can count rows by itself.
Please describe the business process that you need to do. A proper suggestion can probably be provided.