View previous topic :: View next topic
|
Author |
Message |
Pankaj Gupta Currently Banned New User
Joined: 07 May 2008 Posts: 50 Location: Bangalore
|
|
|
|
With all respects, I am a professional in the ibm mainframes environments.
As can be seen at the top of this string, the only reason why then my additions were not working was because one of my fields was one number short.
Then I was getting confused by someone saying I must be converting my numbers to the hex system and then somehow it seemed that I must be writing my own additions subroutine. And then even to me this seemed strange, but always I take off my hat to the people with the larger experience.
Now I have decided not to use the display-7 fields, which, I am understanding, date from the 1980s and perhaps before. |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
Quote: |
Then I was getting confused by someone saying I must be converting my numbers to the hex system and then somehow it seemed that I must be writing my own additions subroutine. And then even to me this seemed strange, but always I take off my hat to the people with the larger experience. |
You might be a professional but You still need to learn how to read the answers You get
nobody, repeat nobody suggested You to write Your own addition routines.
the hex reference was only to show You how the most common cobol representation of numbers are stored in memory...
and the only way to understand is to to show their hexadecimal values
also it funny that a professional would think that in the Anno Domini 2011
somebody should , when using a high level language, write their own addition and simple conversion routines...
even in assembler to convert from zoned to packed a single instruction is all that is needed and the same is true also to convert from packed to binary |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
COBOL understands decimal numbers perfectly well. As long as you obey the rules, the results of any arithmetic operation are perfectly predictable. The rules are clearly laid out in the COBOL Language Reference manual. However, if you do things like move values too large for the PICTURE to a variable, then you cannot expect the results to be predictable -- repeatable, yes, but not necessarily predictable.
I've only been working with COBOL since 1975 and so far I've never had a reason to develop any kind of arithmetic routine for COBOL -- the existing operations have all worked perfectly well for over 35 years so far. The odds that you've found an exception are extremely low. It is far more likely that you are ignoring the standard ways of doing things in favor of doing things your own way. This introduces unnecessary risk to your project and your site since your way cannot possibly be tested as well as the standard routines. |
|
Back to top |
|
|
|