IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

query on comp-3 and comp usage clauses


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
sandy mf

New User


Joined: 26 Jun 2011
Posts: 7
Location: India

PostPosted: Thu Jun 21, 2012 10:00 pm
Reply with quote

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
View user's profile Send private message
Pandora-Box

Global Moderator


Joined: 07 Sep 2006
Posts: 1592
Location: Andromeda Galaxy

PostPosted: Thu Jun 21, 2012 10:04 pm
Reply with quote

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
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Thu Jun 21, 2012 10:13 pm
Reply with quote

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
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8697
Location: Dubuque, Iowa, USA

PostPosted: Thu Jun 21, 2012 10:17 pm
Reply with quote

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
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2501
Location: Atlanta, Georgia, USA

PostPosted: Thu Jun 21, 2012 10:22 pm
Reply with quote

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
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Thu Jun 21, 2012 11:31 pm
Reply with quote

Hi Bill,

I believe the max value of a s9(9) comp-3 field is self-explanitory, no? icon_cool.gif

d
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2501
Location: Atlanta, Georgia, USA

PostPosted: Thu Jun 21, 2012 11:40 pm
Reply with quote

Hi Dick,

Perhaps for the most of us but not for the OP. That's why I advised the OP to consult the manuals.... icon_wink.gif
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts RC query -Time column CA Products 3
No new posts Dynamically pass table name to a sele... DB2 2
No new posts Query on edit primary command CLIST & REXX 5
No new posts Query on edit primary command CLIST & REXX 1
No new posts COBOL - Move S9(11)v9(7) COMP-3 to -(... COBOL Programming 5
Search our Forums:

Back to Top