Cobol v6.2 NUMCHECK选项兼容性 [英] Cobol v6.2 NUMCHECK option compatibility

查看:120
本文介绍了Cobol v6.2 NUMCHECK选项兼容性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们不能为新的COBOL V6.2编译器关闭NUMCHECK选项,因为我们不信任数字变量的内容. 问题是,当我们打开它时,它与我们以前在组织中使用的COBOL 4不完全兼容. 具体来说-当一个无符号打包变量包含X'123C'时,COBOL 4将接受它并让我们继续,但是带有NUMCHECK(PAC,ABD)的COBOL 6.2会放弃,并且只愿意接受X'123F'. 对于我们来说,这是关于汇编程序调用COBOL或从文件等读取的真正问题. 是否有另一种选择或者甚至是PTF可以纠正此行为? 当NUMCHECK启用时,您能否指出我们其他不兼容之处(如果存在)?谢谢!佐哈尔

We can't turn off the NUMCHECK option for our new COBOL V6.2 compiler because we can't trust the content of our numeric variables. The problem is, that when we turn it on, it's not fully compatible with the COBOL 4 we had previously at our organization. Specifically - when an unsigned packed variable contains X'123C' , COBOL 4 would have accepted it and let us continue, but COBOL 6.2 with NUMCHECK(PAC,ABD) abends, and only willing to accept X'123F'. This is a real issue for us regarding assembler invoking COBOL, or reading from files and etc. Is there another option or maybe even a PTF that corrects this behavior? Can you point us to other incompatibilities like this one when NUMCHECK is on, if they exist? Thank you! Zohar

推荐答案

这已在文档中说明.我知道这不是您想听到的,但有时候就是这样.您的应用程序异常终止,因为NUMCHECK编译选项检测到它视为无效数据的地方.

This is working as documented. I know that's not what you wanted to hear, but sometimes that's just the way it is. Your application is abending because the NUMCHECK compile option has detected what it sees as invalid data.

请注意, NUMCLS 安装选项控制IF NUMERIC类测试的行为,该测试的隐式版本由NUMCHECK编译选项生成.如果您打包的数据没有符号定义,即

Note that the NUMCLS installation option for IBM COBOL 6.2 governs the behavior of the IF NUMERIC class test, an implicit version of which is generated by the NUMCHECK compile option. If your packed data is defined without sign, i.e.

77  XYZ  PIC 999 COMP-3.

然后文档指示x'F'的符号半字节是唯一将通过IF NUMERIC类测试的符号半字节.符号半字节的任何其他值均视为无效.

then the documentation indicates a sign nibble of x'F' is the only sign nibble which will pass an IF NUMERIC class test. Any other value for the sign nibble is considered invalid.

NUMCLS 选项肯定是不同的.

您可能要检查 http://www -01.ibm.com/support/docview.wss?uid=swg27041164#112918 查看是否有任何PTF适用于您的情况.

You might want to check at http://www-01.ibm.com/support/docview.wss?uid=swg27041164#112918 to see if any of the PTFs apply to your situation.

您可能会尝试提出与IBM有关的问题,但这就是问题:如果您有未签名的数据,则可以提出这样的论据,即有一个符号正负表示正(x'C')或负(x'D) ')符号无效.我怀疑这是NUMCHECK选项按其方式工作的部分原因.

You could attempt to raise an issue with IBM, but here's the problem: if you have unsigned data, then an argument can be made that having a sign nibble indicating a positive (x'C') or negative (x'D') sign is invalid. I suspect this is part of the reason the NUMCHECK option works the way it does.

可能的解决方案包括让您的汇编程序调用COBOL程序对它们传递的所有打包数据进行符号修复.也许是最后一个字节的OI.您也许可以为商店的SORT实用程序编写控制卡,以修复平面文件中的打包数据.您可以在要签名的COBOL程序中更改未签名的打包数据项.

Possible solutions include having your Assembler programs invoking your COBOL programs do a sign fix on any packed data they pass. Maybe an OI on the last byte. You might be able to write control cards for your shop's SORT utility to fix packed data in your flat files. You could change your unsigned packed data items in your COBOL programs to be signed.

这完全取决于您想要的行为.您说您不信任数字变量的内容.如果那意味着您有时会用x'A'而不是x'C'的符号小数来表示正值,那么如果NUMCLS(ALT)有效,则可以使用NUMPROC(NOPFD).

It all depends on what behavior you desire. You say you cannot trust the content of your numeric variables. If that means you sometimes have a sign nibble of x'A' instead of x'C' for a positive value, you can use NUMPROC(NOPFD) if NUMCLS(ALT) is in effect.

如果启用了NUMCLS(ALT),则针对您情况的另一种可能的解决方案是使用NUMPROC(NOPFD)进行编译,并使用带符号的字段最初保存您的数据.根据文档,将数据移至无符号字段将修复该符号.请注意,NUMPROC(NOPFD)的性能不如NUMPROC(PFD).

Another possible solution to your situation, if NUMCLS(ALT) is in effect, is to compile with NUMPROC(NOPFD) and use signed fields to initially hold your data. According to the documentation, moving the data to an unsigned field will fix the sign. Note that NUMPROC(NOPFD) does not perform as well as NUMPROC(PFD).

以下是我对文档的理解的扩展,该文档的哪些标志位使IF NUMERIC测试为真.我没有办法对此进行测试,这只是我试图将文档的隐式语言转换为显式表的尝试.它确实突出了IBM Enterprise COBOL 4.x和IBM Enterprise COBOL v5及更高版本之间的区别.

Following is an expansion of my understanding of the documentation of which sign nibbles result in an IF NUMERIC test being true. I have no way to test this, it's just my attempt to translate the documentation's implicit language into an explicit table. It does highlight the differences between IBM Enterprise COBOL 4.x and IBM Enterprise COBOL v5 and later.

                      SIGN   COBOL 5+ COBOL 4
NUMCLS NUMPROC SIGNED NIBBLE NUMERIC  NUMERIC
ALT    NOPFD   YES    X'A'   TRUE     TRUE
ALT    NOPFD   YES    X'B'   TRUE     TRUE
ALT    NOPFD   YES    X'C'   TRUE     TRUE
ALT    NOPFD   YES    X'D'   TRUE     TRUE
ALT    NOPFD   YES    X'E'   TRUE     TRUE
ALT    NOPFD   YES    X'F'   TRUE     TRUE
ALT    NOPFD   NO     X'A'   FALSE    TRUE
ALT    NOPFD   NO     X'B'   FALSE    TRUE
ALT    NOPFD   NO     X'C'   FALSE    TRUE
ALT    NOPFD   NO     X'D'   FALSE    TRUE
ALT    NOPFD   NO     X'E'   FALSE    TRUE
ALT    NOPFD   NO     X'F'   TRUE     TRUE
ALT    PFD     YES    X'A'   FALSE    FALSE
ALT    PFD     YES    X'B'   FALSE    FALSE
ALT    PFD     YES    X'C'   TRUE     TRUE
ALT    PFD     YES    X'D'   TRUE     TRUE
ALT    PFD     YES    X'E'   FALSE    FALSE
ALT    PFD     YES    X'F'   FALSE    FALSE
ALT    PFD     NO     X'A'   FALSE    FALSE
ALT    PFD     NO     X'B'   FALSE    FALSE
ALT    PFD     NO     X'C'   FALSE    FALSE
ALT    PFD     NO     X'D'   FALSE    FALSE
ALT    PFD     NO     X'E'   FALSE    FALSE
ALT    PFD     NO     X'F'   TRUE     TRUE
PRIM   NOPFD   YES    X'A'   FALSE    FALSE
PRIM   NOPFD   YES    X'B'   FALSE    FALSE
PRIM   NOPFD   YES    X'C'   TRUE     TRUE
PRIM   NOPFD   YES    X'D'   TRUE     TRUE
PRIM   NOPFD   YES    X'E'   FALSE    FALSE
PRIM   NOPFD   YES    X'F'   TRUE     TRUE
PRIM   NOPFD   NO     X'A'   FALSE    FALSE
PRIM   NOPFD   NO     X'B'   FALSE    FALSE
PRIM   NOPFD   NO     X'C'   FALSE    TRUE
PRIM   NOPFD   NO     X'D'   FALSE    TRUE
PRIM   NOPFD   NO     X'E'   FALSE    FALSE
PRIM   NOPFD   NO     X'F'   TRUE     TRUE
PRIM   PFD     YES    X'A'   FALSE    FALSE
PRIM   PFD     YES    X'B'   FALSE    FALSE
PRIM   PFD     YES    X'C'   TRUE     TRUE
PRIM   PFD     YES    X'D'   TRUE     TRUE
PRIM   PFD     YES    X'E'   FALSE    FALSE
PRIM   PFD     YES    X'F'   FALSE    FALSE
PRIM   PFD     NO     X'A'   FALSE    FALSE
PRIM   PFD     NO     X'B'   FALSE    FALSE
PRIM   PFD     NO     X'C'   FALSE    FALSE
PRIM   PFD     NO     X'D'   FALSE    FALSE
PRIM   PFD     NO     X'E'   FALSE    FALSE
PRIM   PFD     NO     X'F'   TRUE     TRUE

这篇关于Cobol v6.2 NUMCHECK选项兼容性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆