微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

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

如何解决扩展器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

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。