永发信息网

什么情况下用comp-3 类型

答案:2  悬赏:20  手机版
解决时间 2021-04-04 14:40
做项目的过程中,经常会看到一些数据是被定义成comp-3类型,我想请问design的时候是怎样考虑用comp-3的呢?一般什么样的数据用comp-3好一些,最好能举个简单的例子。
最佳答案
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
全部回答
压缩型数据,位数、符号位不同。具体如下: 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.
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
几道高一水平数学题,高手速进!急!
美国纽约为了治理地铁站里的小偷和抢劫现象,
天龙八部3多少级才可以结拜
爱普生9880c平板打印机效果怎么样?
亲`四个字的歌名带有痛字的有哪些`
女人不愿与我说话有什么方法能让她开口又能顺
鹅蛋脸女生该怎样打理刘海而不超过眉毛?
八坑口在什么地方啊,我要过去处理事情
本科读经济学,考研考金融属于跨专业考研吗
欢乐颂包奕凡经典台词,欢乐颂樊胜美语录有哪
这个月四号发工资,我三号自离了,由银行代发
The classroom is almost empty, where
0.96除以0.6等于1.6为什么商比被除数大
苏州市32路公交车转502路在哪个站点转
小黑屋写作软件安全吗,小黑屋写作软件怎么用
推荐资讯
关于友谊的优美句子和成语
上海大学考电子信息类的研究生难吗
我们这儿超市没有卖君乐宝香蕉牛奶的,请问在
14号月经还没来,排卵试纸测到淡粉,有可能怀
期货前期下了两次亏损单,现在不敢下单了怎么
They have been told that if they want to b
什么动物晚上睡觉,家里不知来了什么小动物晚
小说中环境描写的作用是什么
女孩叫李若什么好听呀?
背的多音字是什么意思,背有几个多音字。和多
华为4x用了半年,微信怎么这么卡
网址都失效了怎么办
正方形一边上任一点到这个正方形两条对角线的
阴历怎么看 ?