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

Practical use of comp and comp-3


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

New User


Joined: 09 Apr 2008
Posts: 14

PostPosted: Thu Sep 02, 2010 4:03 pm
Reply with quote

I know the difference between a comp and and comp-3 variable. Could some1 please tell me in what all scenarios the usage comp and comp-3 is preferred?
Back to top
View user's profile Send private message
Phrzby Phil

Senior Member


Joined: 31 Oct 2006
Posts: 1042
Location: Richmond, Virginia

PostPosted: Thu Sep 02, 2010 4:56 pm
Reply with quote

All? That would take some time. I could devote an hour of my day to you, or ...

Have you done any research yourself - I'm just guessing this is a topic that others have already written about, either here or elsewhere (read "world wide web") dontcha think?[/i]
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 Sep 02, 2010 5:08 pm
Reply with quote

You should consult with some of your more Senior Tech's at your site. I'm sure they can give you some sound answers, which you need to run with.

As far as your request, you need to spend time researching this on your own, because an extensive explanation (as Phil has said) is time consuming and is above and beyond what members provide (and for free).

Remember, we are a Help board and members need to put in an effort in an attempt to resolve their questions before posting. If you do this and provide your findings in a given post, you'll find that other members are more receptive and more willing to lend a hand.

Thank You,

Bill
Back to top
View user's profile Send private message
anjoos20

New User


Joined: 09 Apr 2008
Posts: 14

PostPosted: Thu Sep 02, 2010 5:24 pm
Reply with quote

From my research: Comp variables are used as counters and should be integers. Comp-3 variables are used for numeric data like amounts and decimal points are allowed.
Back to top
View user's profile Send private message
Phrzby Phil

Senior Member


Joined: 31 Oct 2006
Posts: 1042
Location: Richmond, Virginia

PostPosted: Thu Sep 02, 2010 5:26 pm
Reply with quote

Your "research" is flawed.
Back to top
View user's profile Send private message
anjoos20

New User


Joined: 09 Apr 2008
Posts: 14

PostPosted: Thu Sep 02, 2010 5:53 pm
Reply with quote

Thanks..
Back to top
View user's profile Send private message
baichunli2010

New User


Joined: 26 Aug 2010
Posts: 3
Location: China

PostPosted: Thu Sep 02, 2010 7:19 pm
Reply with quote

when you use the db2 database, the data type maybe :
decimal(m,n) -----> pic s9(m-n)vn comp-3.
smallint -----> pic 9(04) comp.
integer -----> pic 9(09) comp.

however, comp-3 always used to represent amount when comp is used
for counter and address.
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 Sep 02, 2010 8:26 pm
Reply with quote

Hello,

Quote:
From my research: Comp variables are used as counters and should be integers. Comp-3 variables are used for numeric data like amounts and decimal points are allowed.


Quote:
Your "research" is flawed.
Or at least incomplete. . .

Quote:
Could some1 please tell me in what all scenarios the usage comp and comp-3 is preferred?
If you mention a few specifics, someone may have a suggestion for these specifics (and these suggestions will not always agree. . .).
Back to top
View user's profile Send private message
Phrzby Phil

Senior Member


Joined: 31 Oct 2006
Posts: 1042
Location: Richmond, Virginia

PostPosted: Thu Sep 02, 2010 8:30 pm
Reply with quote

I'll agree to "incomplete," but suggest that incomplete ==> flawed in the context of a newby who would accept another newby's "research" as gospel.
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 Sep 02, 2010 9:50 pm
Reply with quote

Hi Phil,

Quote:
flawed in the context of a newby who would accept another newby's "research" as gospel.
It is quite scary the "things" that people will accept simply because someone else (with even less knowledge) posted them. . .

Brrr (shiver). . .

d
Back to top
View user's profile Send private message
Phrzby Phil

Senior Member


Joined: 31 Oct 2006
Posts: 1042
Location: Richmond, Virginia

PostPosted: Thu Sep 02, 2010 10:58 pm
Reply with quote

My research shows that 3+1 = 10.

[I forgot to tell you I use base 3 arithmetic.]
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


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

PostPosted: Thu Sep 02, 2010 11:02 pm
Reply with quote

Uh, in base 3 wouldn't 10 represent 3?
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Thu Sep 02, 2010 11:17 pm
Reply with quote

Robert Sample wrote:
Uh, in base 3 wouldn't 10 represent 3?


picky, picky, picky!
Back to top
View user's profile Send private message
Phrzby Phil

Senior Member


Joined: 31 Oct 2006
Posts: 1042
Location: Richmond, Virginia

PostPosted: Thu Sep 02, 2010 11:28 pm
Reply with quote

My research is flawed.
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 Sep 02, 2010 11:55 pm
Reply with quote

Quote:
My research is flawed.
He replied flawlessly. . .
Back to top
View user's profile Send private message
santy
Warnings : 1

New User


Joined: 19 Jul 2007
Posts: 22
Location: mumbai

PostPosted: Tue Sep 07, 2010 2:03 pm
Reply with quote

people,

as u all r sr. b'cos more exprience and resarch people compare to others,

but i think the ans given by baichunli2010 was also correct. Also this ans in not enough to solve anjoos20 question.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10872
Location: italy

PostPosted: Tue Sep 07, 2010 2:05 pm
Reply with quote

Quote:
as u all r sr. b'cos more exprience and resarch people compare to others,


please translate to something that we can understand
it is not proper to use sms/kiddie jargon icon_evil.gif
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: Tue Sep 07, 2010 8:02 pm
Reply with quote

Hello,

Quote:
Also this ans in not enough to solve anjoos20 question
Which question? The original?
anjoos wrote:
Could some1 please tell me in what all scenarios the usage comp and comp-3 is preferred?
The first reply is the answer:
Phil wrote:
All? That would take some time.


We do not support the "tell me everything about. . ." questions. There simply is not time/space/willingness to do so. If someone wants "everything" they need to do the research and post here when there is some question/doubt.

Or did you have something else in mind. . .
Back to top
View user's profile Send private message
Elixir

Active User


Joined: 08 Feb 2009
Posts: 116
Location: CHENNAI/NEW JERSEY - INDIA/USA

PostPosted: Mon Sep 13, 2010 6:53 pm
Reply with quote

this will give you some brief idea about Numeric data processing features in Cobol.

ibmmainframes.com/about393.html

Let know for any more details icon_exclaim.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 COBOL - Move S9(11)v9(7) COMP-3 to -(... COBOL Programming 5
No new posts Converting ASCII values to COMP-3 (ZD... JCL & VSAM 2
No new posts Interviewers are surprised with my an... Mainframe Interview Questions 6
No new posts Cobol COMP-2 fields getting scrambled... Java & MQSeries 6
No new posts convert alphanumeric PIC X(02) to hex... COBOL Programming 3
Search our Forums:

Back to Top