Page 1 of 2

COBOL Add statement without 3rd variable

PostPosted: Sun Oct 03, 2010 3:11 pm
by sivanag
HI..

i got a small dought...in cobol.
when we add two numbers...we r giving 3rd veriable to store the result.

Eg..ADD A TO B GIVING C.

in case we dnt use 3rd veriable..the result where ll be store??

eg..ADD A TO B.


REGARDS
SivaNag

Re: help me!!

PostPosted: Sun Oct 03, 2010 5:52 pm
by Robert Sample
This question is one easily answered by looking at the ADD statement in the COBOL Language Reference manual. And you will benefit more from doing the work of finding the manual and getting the information than just having us read the manual for you.

Re: help me!!

PostPosted: Sun Oct 03, 2010 9:54 pm
by dick scherrer
Hello,

Or run a bit of a test. . . With some DISPLAYs before and after the ADD. . .

If something happens that is not clear, post a reply and someone will be able to clarify.

When starting a topic, you need to use a meaningful subject. "help me!" is nonsense and has almost no meaning as the whole reason to post a new question is because one is looking for help. . . :(

Re: help me!!

PostPosted: Tue Oct 12, 2010 8:45 pm
by shindeswap
In this case
ADD A TO B

The result will be stored in A

Re: help me!!

PostPosted: Tue Oct 12, 2010 9:32 pm
by enrico-sorichetti
ADD A TO B
The result will be stored in A

where did You find such interesting definition :?: :shock:

Re: help me!!

PostPosted: Tue Oct 12, 2010 10:59 pm
by Robert Sample
Which reference material did you find that in? The Enterprise COBOL Language Reference manual says the exact opposite -- so I'd really like to find out what reference you found such an error in!

Re: help me!!

PostPosted: Wed Oct 13, 2010 12:12 am
by dick scherrer
Actually, it was a guess with no reference research done. . . There was a 50-50 chance that the sum would go into A or B :)

And if one looked at assembler. . . .

d

Re: help me!!

PostPosted: Wed Oct 13, 2010 4:59 pm
by shindeswap
Sorry it should be
result will store in B because When you use ADD A TO B it means add B=A+B as per my knowledge

Edited to correct content. . .

Re: help me!!

PostPosted: Wed Oct 13, 2010 11:20 pm
by dick scherrer
Hello,

I've corrected the typo in your post to clarify.

I've also deleted the other posts that were more confusing than informative :)

d

Re: help me!!

PostPosted: Thu Oct 14, 2010 1:18 pm
by shindeswap
thank you for this dick scherrer.