扩展器M和R如何在RPGLE上进行CALLP?

问题描述

我正在学习一些RPGLE。但是我没有关于伸肌M和R及其工作原理的任何参考。我只找到有关Extensor E的信息。请接受任何帮助或任何参考!

解决方法

CALLP docs提及

有关如何使用操作扩展器M和R的信息,请参见 Precision Rules for Numeric Operations

点击精确度规则的链接

您可以使用来确保保留小数位 语句通过编码的“结果小数位”精度规则 操作代码扩展器(R)。

请确保您必须深入Default precision rules页面以查明问题

默认,可以为整个模块指定(使用控件 规范关键字EXPROPTS(* MAXDIGITS)或单个自由格式 表达式(使用操作代码扩展器M)。

如果您有RPG手册的PDF版本,则索引中会有一个条目。“操作扩展器”将带您进入“ 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
,

对于CALLP,M和R扩展器会影响如何传递CONST和VALUE参数。

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;                        

此程序显示

DSPLY  2.800000000
DSPLY  2.857142857

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...