I'm learning a little bit of RPGLE. But i don't have any reference of extensors M and R and how they work. I only found information about Extensor E. Please any help or any reference would be accepted!
2 Answers
The CALLP docs mention
For information on how operation extenders M and R are used, see Precision Rules for Numeric Operations.
Following the link to the precision rules says
you can ensure that the decimal positions are kept by using the "Result Decimal Positions" precision rule for the statement by coding operation code extender (R).
Granted you have to dig down into the Default precision rules page to find out that
default and can be specified for an entire module (using control specification keyword EXPROPTS(*MAXDIGITS) or for single free-form expressions (using operation code extender M).
If you have the PDF version of the RPG manual, then there's an entry in the index.."operation extender" which takes you to the section about them in the "Calculation Specification - Traditional Syntax"
Operation Extender:
Entry Explanation
Blank No operation extension supplied
A Used on the DUMP operation to indicate that the operation is always performed regardless of the DEBUG option set on the H specification.
H Half adjust (round) result of numeric operation
N Record is read but not locked
Set pointer to *NULL after successful DEALLOC
P Pad the result field with blanks
D Pass operational descriptors on bound call
Date field
T Time field
Z Timestamp field
M Default precision rules
R "Result Decimal Position" precision rules
E Error handling

- 21,637
- 1
- 20
- 44
For CALLP, the M and R extenders affect how CONST and VALUE parameters are passed.
ctl-opt dftactgrp(*no);
callp(m) proc(2 / (7.0 / 10.0));
callp(r) proc(2 / (7.0 / 10.0));
return;
dcl-proc proc;
dcl-pi *n;
parm packed(10 : 9) const;
end-pi;
dsply (%char(parm));
end-proc;
This program displays
DSPLY 2.800000000
DSPLY 2.857142857

- 3,195
- 8
- 10