IBM I和Z/OS的单一来源
我主要是C开发人员,而不是常规COBOL开发人员。我希望我的COBOL程序在IBM-I上具有与Z/OS上相同的来源。
我的COBOL程序称为子例程。在z/os上,我会这样呼叫:
CALL
'PBFNInit' USING
BY VALUE NULL-POINTER,
在IBM上,我必须这样称呼:
CALL PROCEDURE
'PBFNInit' USING
BY VALUE NULL-POINTER,
有没有某种方式可以动态地告诉COBOL编译器使用哪种呼叫语句格式?
我希望有某种动态语句,例如由此
source-computer控制的调试语句。 IBM-3270具有调试模式。
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
如果您的编译器支持条件编译 ,您可以定义一个带有编译器指令的constant,然后...
每条评论更新1...
您可以尝试将此答案与@SimonSobisch的答案结合起来,例如...
目前文档中没有任何内容表明文本是条件编译必须是有效的代码。也许作者认为这是隐含的,或者也许这是一个错误。
If your compiler supports conditional compilation, you could define a constant with a compiler directive and then...
UPDATE 1 per comment...
You could try combining this answer with that of @SimonSobisch, something like...
There is nothing currently in the documentation to indicate the text being conditionally compiled must be valid code. Maybe the authors felt this was implicit, or maybe it's a bug.
带有调试模式的
将是每个文件的较小更改 - 但也与实际的COBOL功能重叠。
如果“次要更改”适合您,则仅代码
调用过程
并使用单个替换==调用过程== by == call ==
。在来源。
The
WITH DEBUGGING MODE
would be a minor change in each file - but also overlap with an actual COBOL feature.If "minor change" is ok for you then only code
CALL PROCEDURE
and use a singleREPLACE ==CALL PROCEDURE== BY ==CALL==
.in the source.
如果您的所有呼叫都应该是过程调用,则您可以将其设置为所有呼叫,并在编译或过程选项上使用参数。
它说
If all your calls should be procedure calls, it looks like you can set this for all calls with a parameter on the compile or a process option.
https://www.ibm.com/docs/en/i/7.4?topic=program-identifying-linkage-type-called-programs-procedures
It says
我不使用这些编译器,也不开发基础设施 SPL,但如果我必须这样做,因为 PROCEDURE 这个词是 IBM i 上编译器的唯一区别,我会这样做
当然作者:piet.t 2022 年 4 月 1 日
在 IBM i 上编译时将 DEFINE(IBM-I) 作为编译选项,并在 COBOL 源代码中添加 >>DEFINE IBM-I AS PARAMETER(在开头)
在您的 cobol 源代码中,请务必在需要时添加 PROCEDURE 单词
<前><代码> 呼叫
>>如果 IBM-I 定义
程序
>>END-IF
“PBFNInit”使用
按值空指针,[...]
I don't work with these compilers and don't develop infrastructure SPLs, but if I had to, because the word PROCEDURE is the only difference for the compiler on IBM i , I'd do it like this
Of course as said by piet.t Apr. 1/2022
DEFINE(IBM-I) as compile-option when compiling on IBM i and add >>DEFINE IBM-I AS PARAMETER in your COBOL source (at beginning)
Into your cobol source, just be sure to add the PROCEDURE word when needed