View previous topic :: View next topic |
Author |
Message |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
|
|
Back to top |
|
 |
Manas Biswal Intermediate

Joined: 29 Nov 2002 Posts: 382 Topics: 27 Location: Chennai, India
|
Posted: Mon Dec 02, 2002 5:59 am Post subject: |
|
|
Hi Kolusu,
Can you provide me with some more information on COMP-4 and COMP-5. The COBOL book that I use them does not list them. And COMP-4 seems identical with COMP-1. And is COMP-5 used in COBOL on mainframes.
Personally, I have never seen COMP-4 and COMP-5 in production programs.
Regards,
Manas |
|
Back to top |
|
 |
DaveyC Moderator

Joined: 02 Dec 2002 Posts: 151 Topics: 3 Location: Perth, Western Australia
|
Posted: Mon Dec 02, 2002 6:38 am Post subject: |
|
|
Comp-4 is the same as BINARY, not Comp-1 which is single precision floating point (4 bytes). Comp-5 is native binary which can handle halfwords, fullwords or 64 bit integers.
From the manual
Quote: | 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.
|
_________________ Dave Crayford |
|
Back to top |
|
 |
Manas Biswal Intermediate

Joined: 29 Nov 2002 Posts: 382 Topics: 27 Location: Chennai, India
|
Posted: Mon Dec 02, 2002 7:13 am Post subject: |
|
|
Sorry Dave, I mistakenly put COMP as COMP-1.
Regards,
Manas |
|
Back to top |
|
 |
DaveyC Moderator

Joined: 02 Dec 2002 Posts: 151 Topics: 3 Location: Perth, Western Australia
|
Posted: Mon Dec 02, 2002 7:25 am Post subject: |
|
|
No worries. If you were to write a interface to an assembler, C/C++ or PL/1 program then comp-5 is a good choice for mapping integer fields. Otherwise, COBOL might truncate fields it shouldn't... _________________ Dave Crayford |
|
Back to top |
|
 |
|
|