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

Doubt corresponding with packed field


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Pankaj Gupta
Currently Banned

New User


Joined: 07 May 2008
Posts: 50
Location: Bangalore

PostPosted: Fri Jan 28, 2011 4:26 am
Reply with quote

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

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Fri Jan 28, 2011 5:30 am
Reply with quote

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 icon_biggrin.gif
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 icon_cool.gif
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: Fri Jan 28, 2011 6:33 am
Reply with quote

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
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 Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts PD not working for unsigned packed JO... DFSORT/ICETOOL 5
No new posts Def PD not working for unsigned packe... JCL & VSAM 3
No new posts Join 2 files according to one key field. JCL & VSAM 3
No new posts Need Help with Packed Decimal Signs DFSORT/ICETOOL 4
Search our Forums:

Back to Top