COMP为二进制,二进制的计算效率比较高 只有定义 COMP 的变量才以2进制的形式存储和计算的
Cobol实现 IDENTIFICATION DIVISION. PROGRAM-ID.Comp1-Code. ENVIRONMENT DIVISION. DATA DIVISION. WORKING-STORAGE SECTION. 77WS-VAL1 PIC9(2)USAGE IS COMP. 77WS-VAL2 PIC9(3)USAGE IS COMP. 77WS-VAL3 PIC9(6)USAGE IS COMP. 77WS-VAL4 USAGE IS COMP-1. PROCEDURE DIVISION. DISPLAY'COMP USAGE...
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 s...
Cobol 中有两种可用的内部形式: 展示-它是数据的默认内部表示。可以使用 DISPLAY 内部表示指定任何类型的数据。 计算 –只能使用 COMPUTATIONAL 内部表示指定数字数据。 COMPUTATIONAL 表示有多种类型,如 COMP、COMP-1、COMP-2、COMP-3 等。 USAGE 子句用于指定内部表示的类型。您可以为 USAGE 子句使用任何级别编号,...
可能会对你有兴趣的是ICOBOL的文档。特别是第196页上的“USAGE IS BINARY 或 COMPUTATIONAL子句指定了计算机存储中数字项目的二进制补码大端表示法。下表列出了存储BINARY和COMPUTATIONAL项目所需的字节数。”- cschneid 我使用示例数据中第一条记录中包含的值创建了一个带有三个日期字段的COBOL文件。第一个和第三个...
I have a copybook where the field is defied as PIC S9(10)V USAGE COMP-3. When we read the file in cobrix this field is being created as Long instead of Decimal(10,0). Is it expected this way because its spark property or can it be create...
压缩十进制格式意味着每个存储字节(低位字节除外)可以包含两个十进制数。低位字节包含最左边部分中的一个数字和最右边部分中的符号(正或负)。 下图中的分区十进制格式是COBOL 中数字的默认存储空间。 01 WS-NUM PIC 9(5) USAGE IS COMP-3 VALUE 21544. 计算存储通常用于减小文件的大小。
The low-order byte contains one digit in the leftmost portion and the sign (positive or negative) in the rightmost portion. "Zoned decimal format" in the image below is the default storage for a number in COBOL. 01 WS-NUM PIC 9(5) USAGE IS COMP-3 VALUE 21544. Computational storage ...
Comp-3 fields are denoted in COBOL with the "usage is" clause after the PIC, like this: PIC S9(5) usage is computational-3. However, the "usage is" is not required and seldom used, and "computational-3" is usually abbreviated "comp-3", so you more commonly see: ...
COBOL Programming: Is it possible to redefine alphanumeric with COMP as illustrated 05 WS-INPUT-X PIC X(9). 05 WS-INPUT REDEFINES WS-INPUT-X PIC S9(9) USAGE COMP. My...