IBM I和Z/OS的单一来源

发布于 2025-01-18 02:17:18 字数 541 浏览 5 评论 0 原文

我主要是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具有调试模式。

I am primarily a C developer, not a regular COBOL developer. I would like my COBOL program to have the same source on IBM-i as it does on z/OS.

My COBOL program calls a subroutine. On z/OS I do the call like this:

CALL                                      
  'PBFNInit' USING                        
                    BY VALUE NULL-POINTER,

On IBM i I have to call like this:

    CALL PROCEDURE
      'PBFNInit' USING                        
                        BY VALUE NULL-POINTER,

Is there some way I can dynamically tell the COBOL compiler which format of the CALL statement to use?

I was hoping for some kind of dynamic statement like the debug statement controlled by this

SOURCE-COMPUTER. IBM-3270 WITH DEBUGGING MODE.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

后知后觉 2025-01-25 02:17:18

如果您的编译器支持条件编译 ,您可以定义一个带有编译器指令的constant,然后...

    >>EVALUATE TRUE
    >>WHEN DEFINED IBM-Z
        CALL 'PBFNInit' USING                        
            BY VALUE NULL-POINTER, [...]
    >>WHEN DEFINED IBM-I
        CALL PROCEDURE 'PBFNInit' USING                        
            BY VALUE NULL-POINTER, [...]
    >>WHEN OTHER
        !non-sequiter, your facts do not coordinate
    >>END-EVALUATE

每条评论更新1...

您可以尝试将此答案与@SimonSobisch的答案结合起来,例如...

    >>IF DEFINED IBM-I
        REPLACE ==CALL== BY ==CALL PROCEDURE==.
    >>END-IF

        CALL 'PBFNInit' USING                        
            BY VALUE NULL-POINTER, [...]

目前文档中没有任何内容表明文本是条件编译必须是有效的代码。也许作者认为这是隐含的,或者也许这是一个错误。

If your compiler supports conditional compilation, you could define a constant with a compiler directive and then...

    >>EVALUATE TRUE
    >>WHEN DEFINED IBM-Z
        CALL 'PBFNInit' USING                        
            BY VALUE NULL-POINTER, [...]
    >>WHEN DEFINED IBM-I
        CALL PROCEDURE 'PBFNInit' USING                        
            BY VALUE NULL-POINTER, [...]
    >>WHEN OTHER
        !non-sequiter, your facts do not coordinate
    >>END-EVALUATE

UPDATE 1 per comment...

You could try combining this answer with that of @SimonSobisch, something like...

    >>IF DEFINED IBM-I
        REPLACE ==CALL== BY ==CALL PROCEDURE==.
    >>END-IF

        CALL 'PBFNInit' USING                        
            BY VALUE NULL-POINTER, [...]

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.

愚人国度 2025-01-25 02:17:18

带有调试模式的 将是每个文件的较小更改 - 但也与实际的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 single

REPLACE ==CALL PROCEDURE== BY ==CALL==.

in the source.

一抹淡然 2025-01-25 02:17:18

如果您的所有呼叫都应该是过程调用,则您可以将其设置为所有呼叫,并在编译或过程选项上使用参数。

它说

crtcblmod和crtbndcbl命令的Linklit参数,或
关联的过程语句选项。

crtcblmod和crtbndcbl命令的Linklit参数允许
您要在编译时指定所有外部的链接类型
致电文字1,取消文字1或设置过程 - 销售数据 - data-item
输入ILE COBOL计划中的文字1语句。你没有
需要在特殊名称段落中指定链接类型子句
或带有呼叫,取消或设置的链接类型短语…条目
语句何时由linklit参数定义了链接
crtcblmod或crtbndcbl。

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

the LINKLIT parameter of the CRTCBLMOD and CRTBNDCBL commands, or the
associated PROCESS statement option.

The LINKLIT parameter of the CRTCBLMOD and CRTBNDCBL commands allows
you to specify, at compile time, the linkage type for all external
CALL literal-1, CANCEL literal-1, or SET procedure-pointer-data-item
TO ENTRY literal-1 statements in the ILE COBOL program. You do not
need to specify the LINKAGE TYPE clause in the SPECIAL-NAMES paragraph
or the LINKAGE TYPE phrase with the CALL, CANCEL, or SET…ENTRY
statement when the linkage has been defined by the LINKLIT parameter
of CRTCBLMOD or CRTBNDCBL.

三人与歌 2025-01-25 02:17:18

我不使用这些编译器,也不开发基础设施 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

     CALL 
         >>IF IBM-I DEFINED 
              PROCEDURE
         >>END-IF
    
          'PBFNInit' USING                        
           BY VALUE NULL-POINTER, [...]
    
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文