cobol语言中comp类型(在cobol语言中,如 code pic s9(9) comp 中的comp有什么作用,)

本文目录
- 在cobol语言中,如 code pic s9(9) comp 中的comp有什么作用,
- cobol语言COMP,COMP-1,COMP-2,COMP-3,COMP-5谁给具体解释下
- Cobol中的comp-3,comp-4等数据类型是个啥东西,如何用
- cobol中comp数据类型的小问题,请大虾帮忙
在cobol语言中,如 code pic s9(9) comp 中的comp有什么作用,
comp就是指定点二进制,也就是每个数字用十六进制表示
如:二进制 005212
就是 FFFFFF
005212
COMP-1型,也就是内部短浮点形式
cobol语言COMP,COMP-1,COMP-2,COMP-3,COMP-5谁给具体解释下
压缩型数据,位数、符号位不同。具体如下:
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.
Cobol中的comp-3,comp-4等数据类型是个啥东西,如何用
COPM 定点二进制,COPM-1 内部短浮点又称为单精度浮点,COPM-2 内部长浮点又称为双精度浮点,COPM-3 内部十进制,COMP-4 内部十六进制……至于用法,大致都一样,如下:01 A PIC 9(3) COPM-3……
cobol中comp数据类型的小问题,请大虾帮忙
Q:一个S9(7)的COMP-3型占用多少字节?
A:占用4字节。COMP-3用内部十进制存储,S9(7)中的S是要占空间的,符号占4位,7个数字,每个4位(半个字节),所以是(4+7*4)/8=4字节(字节和位的比例不要搞错了哦)
Q39) How many bytes does a S9(7) SIGN TRAILING SEPARATE field occupy ?
Q39) Will occupy 8 bytes (one extra byte for sign).
Q:一个S9(7) SIGN TRAILING SEPARATE区域占多少字节
A:这里是每个符号单独分配空间(也就是没个数值用1个字节表示,就象最常用的DISPLAY型的分配方式),算上S的空间,所以是7+1=8字节。一般情况省略的SIGN子句都是隐含SIGN IS TRAILING的
Q40) How many bytes will a S9(8) COMP field occupy ?
Q40) 4 bytes.
Q: 一个S9(8) COMP 区域占多少字节
A:如果之前关于COMP的解释听懂了的话,那很显然就是4字节了(定点二进制用2字节存储1~4,4字节存储5~9,……类推,你可以自己推下),如果这块还不懂的可以问我或者查下书
Q41) What is the maximum value that can be stored in S9(8) COMP?
Q41) 99999999
Q:S9(8)COMP型最多存储的最大值是什么
A:除了8个数值外不要忽略符号位
***隐藏网址***
***隐藏网址***

更多文章:
avantage怎么设置为中文(Avantage安装丢失GIT)
2026年10月15日 03:00
activex控件未注册怎么办(登陆视频监控网页时提示activex控件未注册,怎么解决)
2026年10月14日 20:30
excel连接sql数据库教程(excel怎么连接sql数据库)
2026年10月14日 19:40






