ibm-midrange - 在非循环程序中设置*inlr有什么影响吗?

标签 ibm-midrange rpgle

我最近偶然发现一个服务程序,其中在显式关闭文件后使用 *inlr = *on (下面的代码)。对我来说感觉有点过分了。据我发现,RPG 循环负责处理资源的释放。因此,如果没有循环(即在具有 main/nomain h-specs 的程序中),则 *inlr = *on 无法产生任何效果,但是......我无法找到任何确认,因为与周期相关的问题对我来说很新,我可能会遗漏一些东西......

if %open(file);      
  close file;        
endif;                  
*inlr = *on;            
return *on; 

最佳答案

简而言之,没有。

“最后记录”指示器仅由循环使用。它不用于 NOMAIN 服务程序或线性 MAIN 程序。

RPG IV Programmer's Guide

Note No cycle code is generated for subprocedures or when MAIN or NOMAIN is specified on the control specification.

其他引用
IBM 的 Barbara Morris(RPGLE 编译器开发人员,在 post to the RPG mailing list 中)

The linear-main procedure will just end when it gets to the end of the calculations. You can set on *INLR if you want, but it won't do any of the cycle-related things like closing files.

Here is a comparison of a cycle-main module and a linear-main module.http://publib.boulder.ibm.com/infocenter/iseries/v7r1m0/index.jsp?topic=%2Frzasd%2Fsc09250802.htm "

关于ibm-midrange - 在非循环程序中设置*inlr有什么影响吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46155924/

相关文章:

service - ILE RPG 使用 CRTSQLRPGI 通过引用进行绑定(bind)

ibm-midrange - RPG(LE) 中的数据结构定义/模板

ibm-midrange - 如何在部分自由格式 RPG 中将变量/字段值转换为 IBM 签名数值

stored-procedures - 存储过程尝试读取未提交的数据,尽管将隔离级别指定为读取已提交

ibm-midrange - SQLRPGLE 源大小限制

DB2 版本的 SQL 差异

sql - 插入带有字母字符串和压缩小数的混合 db2 字段

java - RPG iSeries 从 Java 函数中获取 byte[] 中的 PDF 并将其写入 IFS

syntax - IBM iSeries 的 DB2 : IF EXISTS statement syntax

c++ - 为 ibm i ILE C/C++ 指定控制语句