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

[Closed]Why COMP-1 and COMP-2 dont hav picture clause


IBM Mainframe Forums -> COBOL Programming
Post new topic   This topic is locked: you cannot edit posts or make replies.
View previous topic :: View next topic  
Author Message
cobolunni

Active User


Joined: 07 Aug 2006
Posts: 127
Location: kerala,india

PostPosted: Fri Mar 09, 2007 1:17 am
Reply with quote

dick scherrer wrote:

In fact, business arithmetic on the mainframe is not binary most of the time.


thats wrong no electronic macheine in the world which can directly process data which is not converted into machiene language ie binary
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: Fri Mar 09, 2007 1:30 am
Reply with quote

You need to learn much more before you post such as this.
Quote:
no electronic macheine in the world which can directly process data which is not converted into machiene language ie binary


Packed-decimal is part of the machine language on the mainframe.

If you took the time to look at the generated assembler, and the machine code generated from that, you would learn that there are different machine instructions for packed-decimal arithmetic and binary aritmetic.

It really is time the moderator closes this topic.
Back to top
View user's profile Send private message
cobolunni

Active User


Joined: 07 Aug 2006
Posts: 127
Location: kerala,india

PostPosted: Fri Mar 09, 2007 2:04 am
Reply with quote

a computer machiene understands only binary or machiene language. if we need number 2 to be identified by computer it will be converted into binary ie 0010 the packed decimal for 2 is also 0010.

the difference bt binary and packed decimal is that

eg 12 binary is 1100 and bcd is 0001 0010 in both case actually we are converting a decimal into binary so packed decimal is a binary format inwhich each digit is represented in binary
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Fri Mar 09, 2007 3:52 am
Reply with quote

cobolunni wrote:
a computer machiene understands only binary or machiene language. if we need number 2 to be identified by computer it will be converted into binary ie 0010 the packed decimal for 2 is also 0010.
Oh good, the magic word, "machine language"......On a machine language level (though the packed data is "represented" in binary - because that is how memory works), the machine language processing does not do binary math, it does packed decimal math. When it adds 2 + 2, it adds X'2C' to X'2C' and the result is X'4C'. It sees the digits a byte a a time.
Do you grasp this yet?
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: Fri Mar 09, 2007 5:42 am
Reply with quote

Hi Bill,

No, he doesn't. Earlier in the thread i tried to explain that but he is completely focused - incorrectly.

I believe his background is not mainframe and cannot relate to the fact that there really are machine instructions that are not binary on the mainframe.

Oh, well. Like i suggested earlier, probably a good time to close this thread.
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Fri Mar 09, 2007 5:48 am
Reply with quote

Sometimes some people just do not see the difference betwee "A and "B", all they see is that "they're letters, so what"..... icon_rolleyes.gif
Back to top
View user's profile Send private message
cobolunni

Active User


Joined: 07 Aug 2006
Posts: 127
Location: kerala,india

PostPosted: Fri Mar 09, 2007 1:45 pm
Reply with quote

Quote:
COBOL Computational Fields:
This is a discussion of COBOL Computational fields. Several numeric data types are discussed, including the common "packed" and "comp-3" fields.


By default, numeric values in COBOL files are stored in display, or character, format. That is, the value is stored as a base-ten number, with each digit represented by the corresponding EBCDIC (or ASCII) character. For example, the value 1234 is stored in four bytes which contain "1", "2", "3", and "4" (F1, F2, F3, F4 Hex).

But because computers perform computations with binary numbers, it is more efficient to store values in their native binary form than to store them in human readable base ten. If the number is stored in its native binary format it can be input from the file and used directly. If it's stored in a base ten format it needs to be converted to binary before performing calculations on it, then converted back to base ten for storage. Binary is faster -- typically about 8 times -- and usually requires less storage space.

this is from http://www.discinterchange.com/TechTalk_COBOL_comp_.html

see the line because computers perform computations with binary numbers, it is more efficient to store values in their native binary form than to store them in human readable base ten

as far as i know This is what main aim of COMP and
Quote:
When it adds 2 + 2, it adds X'2C' to X'2C' and the result is X'4C'


as a student from electronics i am not understand that because GATES and BUFFERS are the main building blocks of computer as far as i know electrical pulses does the arithmatic .I dont know how computer will know what is that X2C that is a higher version

william you are seeing things only from ouside i think you had to read more to get inside
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Fri Mar 09, 2007 6:48 pm
Reply with quote

icon_rolleyes.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: Fri Mar 09, 2007 9:34 pm
Reply with quote

Hi Bill,

Once again, he is posting information that is not mainframe-based.

If we could only get him to realize that windows/unix are very different than the IBM mainframe.

Probably won't happen. For some, what they learn first, overrides any additional learning.

Maybe with time he'll learn that while a lot of the syntax is the same, much of the underlying infrastructure is not between the platforms.
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Fri Mar 09, 2007 11:43 pm
Reply with quote

We can alway hope....

Never the less, 'nuff said....
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   This topic is locked: you cannot edit posts or make replies. View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming Goto page 1, 2  Next

 


Similar Topics
Topic Forum Replies
No new posts COBOL - Move S9(11)v9(7) COMP-3 to -(... COBOL Programming 5
No new posts To search DB2 table based on Conditio... DB2 1
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
Search our Forums:

Back to Top