View previous topic :: View next topic
|
Author |
Message |
sandy mf
New User
Joined: 26 Jun 2011 Posts: 7 Location: India
|
|
|
|
when we move 9(10) to s9(08) comp-3 and s9(08) comp variables does truncation occur.
If no what's the maximum value that can be moved to a s9(08) comp-3 and s9(08) comp variables |
|
Back to top |
|
|
Pandora-Box
Global Moderator
Joined: 07 Sep 2006 Posts: 1592 Location: Andromeda Galaxy
|
|
|
|
Did you try writing a small program with displays on??
What was the output?
If you could answer me you can solve this your self .. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
At the top of the page is a link to "IBM Manuals".
Suggest you look in the COBOL Language Reference for the maximum values for numeric fields. If you find something that is not clear, post what you found and your doubt. Someone will be able to clarify.
We will help, but we are not a manual reading service. . . |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8697 Location: Dubuque, Iowa, USA
|
|
|
|
Quote: |
If no what's the maximum value that can be moved to a s9(08) comp-3 and s9(08) comp variables |
In addition to Dick's suggestion, you'll want to read the Programming Guide manual for information about compiler options, since the options used can impact the maximum value a COMP variable can hold. In other words, the answer to your question is "it depends". |
|
Back to top |
|
|
Bill O'Boyle
CICS Moderator
Joined: 14 Jan 2008 Posts: 2501 Location: Atlanta, Georgia, USA
|
|
|
|
Even numbered COMP-3 fields (except for 18) make no sense as they take up the same amount of storage. Use S9(09) COMP-3 instead.
As far as S9(08) COMP, if you're worried about high-order truncation, use the TRUNC(BIN) compile option and S9(09) COMP.
If your compiler supports COMP-5 (Native Binary) then change COMP to COMP-5 and the TRUNC option setting has no effect and high-order truncation will NOT occur.
The maximum positive value in a Signed 4-Byte Binary (COMP/COMP-5) field is X'7FFFFFFFFFFFFFFF'. If you remove the S from the picture clause, the maximum field value is X'FFFFFFFFFFFFFFFF', which is NOT negative one when the field is unsigned.
Maximum value in an S9(09) COMP-3 field should be easy to find in any of the manuals. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hi Bill,
I believe the max value of a s9(9) comp-3 field is self-explanitory, no?
d |
|
Back to top |
|
|
Bill O'Boyle
CICS Moderator
Joined: 14 Jan 2008 Posts: 2501 Location: Atlanta, Georgia, USA
|
|
|
|
Hi Dick,
Perhaps for the most of us but not for the OP. That's why I advised the OP to consult the manuals.... |
|
Back to top |
|
|
|