我最近偶然发现一个服务程序,其中在显式关闭文件后使用 *inlr = *on (下面的代码)。对我来说感觉有点过分了。据我发现,RPG 循环负责处理资源的释放。因此,如果没有循环(即在具有 main/nomain h-specs 的程序中),则 *inlr = *on 无法产生任何效果,但是......我无法找到任何确认,因为与周期相关的问题对我来说很新,我可能会遗漏一些东西......
if %open(file);
close file;
endif;
*inlr = *on;
return *on;
最佳答案
简而言之,没有。
“最后记录”指示器仅由循环使用。它不用于 NOMAIN 服务程序或线性 MAIN 程序。
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/