COBOL Add statement without 3rd variable



Support for OS/VS COBOL, VS COBOL II, COBOL for OS/390 & VM and Enterprise COBOL for z/OS

COBOL Add statement without 3rd variable

Postby sivanag » Sun Oct 03, 2010 3:11 pm

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
sivanag
 
Posts: 2
Joined: Wed Sep 22, 2010 4:35 pm
Has thanked: 0 time
Been thanked: 0 time

Re: help me!!

Postby Robert Sample » Sun Oct 03, 2010 5:52 pm

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.
Robert Sample
Global moderator
 
Posts: 3720
Joined: Sat Dec 19, 2009 8:32 pm
Location: Dubuque, Iowa, USA
Has thanked: 1 time
Been thanked: 279 times

Re: help me!!

Postby dick scherrer » Sun Oct 03, 2010 9:54 pm

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. . . :(
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times

Re: help me!!

Postby shindeswap » Tue Oct 12, 2010 8:45 pm

In this case
ADD A TO B

The result will be stored in A
shindeswap
 
Posts: 12
Joined: Sat Feb 13, 2010 1:41 pm
Has thanked: 0 time
Been thanked: 0 time

Re: help me!!

Postby enrico-sorichetti » Tue Oct 12, 2010 9:32 pm

ADD A TO B
The result will be stored in A

where did You find such interesting definition :?: :shock:
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort
enrico-sorichetti
Global moderator
 
Posts: 3003
Joined: Fri Apr 18, 2008 11:25 pm
Has thanked: 0 time
Been thanked: 164 times

Re: help me!!

Postby Robert Sample » Tue Oct 12, 2010 10:59 pm

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!
Robert Sample
Global moderator
 
Posts: 3720
Joined: Sat Dec 19, 2009 8:32 pm
Location: Dubuque, Iowa, USA
Has thanked: 1 time
Been thanked: 279 times

Re: help me!!

Postby dick scherrer » Wed Oct 13, 2010 12:12 am

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
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times

Re: help me!!

Postby shindeswap » Wed Oct 13, 2010 4:59 pm

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. . .
shindeswap
 
Posts: 12
Joined: Sat Feb 13, 2010 1:41 pm
Has thanked: 0 time
Been thanked: 0 time

Re: help me!!

Postby dick scherrer » Wed Oct 13, 2010 11:20 pm

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
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times

Re: help me!!

Postby shindeswap » Thu Oct 14, 2010 1:18 pm

thank you for this dick scherrer.
shindeswap
 
Posts: 12
Joined: Sat Feb 13, 2010 1:41 pm
Has thanked: 0 time
Been thanked: 0 time

Next

Return to IBM Cobol

 


  • Related topics
    Replies
    Views
    Last post