Tags

, , , ,

Computational items

A computational item is a value used in arithmetic operations. It must be

numeric. If a group item is described with a computational usage, the

elementary items within the group have that usage.

The maximum length of a computational item is 18 decimal digits, except

for a PACKED-DECIMAL item. If the ARITH(COMPAT) compiler option is in

effect, then the maximum length of a PACKED-DECIMAL item is 18 decimal

digits. If the ARITH(EXTEND) compiler option is in effect, then the

maximum length of a PACKED-DECIMAL item is 31 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

COMPUTATIONAL-1 and COMPUTATIONAL-2 items (internal floating-point) cannot

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) ¦

+—————————————————————————-+

Binary data is big-endian: the operational sign is contained in

the leftmost bit.

BINARY, COMPUTATIONAL, and COMPUTATIONAL-4 data items can be

affected by the TRUNC compiler option. For information about the

effect of this compiler option, see the Enterprise COBOL

Programming Guide.

PACKED-DECIMAL Specified for internal decimal items. Such an item appears

in storage in packed decimal format. There are two 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 Enterprise COBOL Programming Guide.

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.

 

 

You may also like to look at:

Important SQL CODES and ABEND CODES
SORT JOIN – TO JOIN TWO FILES BASED ON A KEY
KNOW YOUR MAINFRAME
REXX – INITIAL SETUP
HOW TO SUBMIT A BATCH JOB FROM THE CICS PROGRAM
CICS – EXEC interface block – EIBRESP Values
CICS – EXEC interface block Fields
Flow of control between COBOL programs, run units, and CICS
CICS INTERVIEW QUESTIONS
CICS TIPS
COBOL – COPY and INCLUDE statements
COBOL – PERFORMANCE IMPROVEMENT
COBOL – SIGN STORED IN COMP, COMP-3 AND DISPLAY FORMATS
SHORTEST COBOL PROGRAM
RESTART LOGIC IN COBOL DB2 Program
GOBACK – EXIT PROGRAM – STOP RUN
Continuation lines in COBOL
Computational items – COMP, COMP 1 , COMP 2, COMP 3
COBOL program format
cobol indicator area column-7 and area a and area b
COBOL INTERVIEW QUESTIONS
COBOL TIPS
COBOL COMPILER OPTIONS
The IDENTIFICATION DIVISION


Advertisements