什么情况下用comp-3 类型
答案:2 悬赏:20 手机版
解决时间 2021-04-04 14:40
- 提问者网友:抽煙菂渘情少年
- 2021-04-03 14:31
做项目的过程中,经常会看到一些数据是被定义成comp-3类型,我想请问design的时候是怎样考虑用comp-3的呢?一般什么样的数据用comp-3好一些,最好能举个简单的例子。
最佳答案
- 五星知识达人网友:撞了怀
- 2021-04-03 16:06
COMP-3 压缩十进制,每位数字占0.5个字节,S也占0.5个字节,正数时对应16进制等于C,负数D,无正负号则为F,其符号位在最后一位的第八位上。
comp型中以二进制存储。其中:
9(01),9(02),9(03),9(04) 占2个字节
9(5)~ 9(9) 占4个字节
9(10) ~ 9(18) 占8个字节
正数: 以该数据二进制对应,忽略小数点位数。
负数:是其绝对值对应二进制的补码。
例如: -12.34 12.34
99V99 COMP-3 01234F 01234F
S99V99 COMP-3 01234D 01234C
S99V99 COMP FB2E 04D2(04D2=1234)
99V99 COMP 04D2 04D2
S99 COMP FFF4 000C
comp-3型
压缩10进制和非压缩10进制
1). 非压缩10进制
数字字符1的EBCDIC代码为11110001,其书写格式位F1
数字字符2的EBCDIC代码为11110002,其书写格式位F2
数字字符3的EBCDIC代码为11110003,其书写格式位F3
数字-123就是F1F2D3(D代表负号)
2). 压缩10进制
压缩10进制就是把F去掉保留符号位
F1F2D3压缩10进制就是123D
换算公式:(非压缩10进制数/2)+1
comp型中以二进制存储。其中:
9(01),9(02),9(03),9(04) 占2个字节
9(5)~ 9(9) 占4个字节
9(10) ~ 9(18) 占8个字节
正数: 以该数据二进制对应,忽略小数点位数。
负数:是其绝对值对应二进制的补码。
例如: -12.34 12.34
99V99 COMP-3 01234F 01234F
S99V99 COMP-3 01234D 01234C
S99V99 COMP FB2E 04D2(04D2=1234)
99V99 COMP 04D2 04D2
S99 COMP FFF4 000C
comp-3型
压缩10进制和非压缩10进制
1). 非压缩10进制
数字字符1的EBCDIC代码为11110001,其书写格式位F1
数字字符2的EBCDIC代码为11110002,其书写格式位F2
数字字符3的EBCDIC代码为11110003,其书写格式位F3
数字-123就是F1F2D3(D代表负号)
2). 压缩10进制
压缩10进制就是把F去掉保留符号位
F1F2D3压缩10进制就是123D
换算公式:(非压缩10进制数/2)+1
全部回答
- 1楼网友:行路难
- 2021-04-03 16:44
压缩型数据,位数、符号位不同。具体如下:
computational or comp (binary) this is the equivalent of binary. the computational phrase is synonymous with binary.
computational-1 or comp-1 (floating-point) specified for internal floating-point items (single precision). comp-1 items are 4 bytes long.
computational-2 or comp-2 (long floating-point) specified for internal floating-point items (double precision). comp-2 items are 8 bytes long.
computational-3 or comp-3 (internal decimal) this is the equivalent of packed-decimal.
computational-4 or comp-4 (binary) this is the equivalent of binary. computational-5 or comp-5 (native binary) these data items are represented in storage as binary data. the data items can contain values up to the capacity of the native binary representation (2, 4 or 8 bytes), rather than being limited to the value implied by the number of nines in the picture for the item (as is the case for usage binary data). when numeric data is moved or stored into a comp-5 item, truncation occurs at the binary field size rather than at the cobol picture size limit. when a comp-5 item is referenced, the full binary field size is used in the operation. the trunc(bin) compiler option causes all binary data items (usage binary, comp, comp-4) to be handled as if they were declared usage comp-5.
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯