Library View Topics Framed Contents Revised Topics Previous Topic Next Topic Search Search ResultsPrevious Topic MatchNext Topic Match Notes List Notes Print Download No PDF Handheld DisconnectedHandheld ConnectedHelp

5.3.16.1 Computational Items



A computational item is a value used in arithmetic operations. It must be numeric. If the USAGE of a group item is described with any of these items, the elementary items within the group have this usage.

The maximum length of a computational item is 18 decimal digits.

The PICTURE of a computational item can contain only:

9
One or more numeric character positions
S
One operational sign
V
One implied decimal point
P
One or more decimal scaling positions


X COMPUTATIONAL-1 and COMPUTATIONAL-2 items (internal floating-point) cannot
X have PICTURE strings.

BINARY
Specified for binary data items. Such items have a decimal equivalent consisting of the decimal digits 0 through 9, plus a sign. Negative numbers are represented as the two's complement of the positive number with the same absolute value.

The amount of storage occupied by a binary item depends on the number of decimal digits defined in its PICTURE clause:


 Digits in PICTURE Clause              Storage Occupied                    
 1 through 4                           2 bytes (halfword)                  
 5 through 9                           4 bytes (fullword)                  
 10 through 18                         8 bytes (doubleword)                


The operational sign for "big-endian" binary data (such as OS/390 and VM) is contained in the left most bit of the binary data. The operational sign for "little-endian" binary data is contained in the left most bit of the right most byte of the binary data.


X Note: BINARY, COMPUTATIONAL, and COMPUTATIONAL-4 data items can be
X affected by the BINARY and TRUNC compiler option specifications. For
X information on the effect of these compiler options, see the IBM COBOL
X Programming Guide for your platform. (The BINARY compiler option is
X only applicable to OS/2 and Windows programs.)

PACKED-DECIMAL
Specified for internal decimal items. Such an item appears in storage in packed decimal format. There are 2 digits for each character position, except for the trailing character position, which is occupied by the low-order digit and the sign. Such an item can contain any of the digits 0 through 9, plus a sign, representing a value not exceeding 18 decimal digits.

The sign representation uses the same bit configuration as the 4-bit sign representation in zoned decimal fields. For details, see the IBM COBOL Programming Guide for your platform.

COMPUTATIONAL or COMP (Binary)
This is the equivalent of BINARY. The COMPUTATIONAL phrase is synonymous with BINARY.


X COMPUTATIONAL-1 or COMP-1 (Floating-Point)

X Specified for internal floating-point items (single precision).
X COMP-1 items are 4 bytes long.


X >_Workstation_> COMP-1 data items are affected by the
X FLOAT(NATIVE|HEX) compiler option. For details, see the IBM COBOL
X Programming Guide for your platform <_Workstation_<


X COMPUTATIONAL-2 or COMP-2 (Long Floating-Point)

X Specified for internal floating-point items (double precision).
X COMP-2 items are 8 bytes long.


X >_Workstation_> COMP-2 data items are affected by the
X FLOAT(NATIVE|HEX) compiler option. For details, see the IBM COBOL
X Programming Guide for your platform <_Workstation_<


X COMPUTATIONAL-3 or COMP-3 (Internal Decimal)

X This is the equivalent of PACKED-DECIMAL.


X COMPUTATIONAL-4 or COMP-4 (Binary)

X This is the equivalent of BINARY.


X COMPUTATIONAL-5 or COMP-5 (Native Binary)

X >_Workstation_> Under AIX, OS/2, and Windows, this represents native
X binary data. In a COMP-5 binary data item, the total precision of the
X literal (integer and decimal positions) can be up to the maximum value
X that can be accommodated in the number of bytes allocated for the
X binary field (for example, 2, 4, or 8 bytes) rather than conforming to
X the maximum integer and decimal positions specified in the PICTURE
X clause. This is always the native binary data, independent of the
X BINARY compiler option. <_Workstation_<


Previous Topic Next Topic © Copyright IBM Corp. 1991, 1998

IBM Library Server Copyright 1989, 2005 IBM Corporation. All rights reserved.





Return to library:   z/OS | z/OS.e | TPF | z/VSE | z/VM | IBM Hardware | IBM System z Redbooks
Glossary:   IBM terminology
Publications:   How to order publications
Readers:   Download IBM Library Reader | Download IBM Softcopy Reader | Download Adobe® Acrobat® Reader®
Library management:   Download IBM Softcopy Librarian
Contacts:   Contact z/OS


Adobe, the Adobe logo, Acrobat, the Acrobat logo, and Acrobat Reader are registered trademarks of Adobe Systems incorporated.