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

Re: help me!!

Postby dick scherrer » Fri Oct 15, 2010 12:06 am

You're welcome :)

d
User avatar
dick scherrer
Global moderator
 
Posts: 6304
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 91 times

Re: Re: help me!!

 

Re: COBOL Add statement without 3rd variable

Postby shankarhosur » Thu Oct 28, 2010 1:21 am

Hello,

Result will store in B
ADD A TO B means B=A+B; (its like add 1 to B we usually use...)
so results will store in B.
JFYI,
MOVE 1 TO WS-VAR1
MOVE 2 TO WS-VAR2
DISPLAY 'BEFORE ADD WS-VAR1:' WS-VAR1
DISPLAY 'BEFORE ADD WS-VAR2:' WS-VAR2
ADD WS-VAR1 TO WS-VAR2
DISPLAY 'AFTER ADD WS-VAR1:' WS-VAR1
DISPLAY 'AFTER ADD WS-VAR2:' WS-VAR2

Output of the code is:
BEFORE ADD WS-VAR1:0001
BEFORE ADD WS-VAR2:0002
AFTER ADD WS-VAR1:0001
AFTER ADD WS-VAR2:0003
shankarhosur
 
Posts: 10
Joined: Sat Oct 16, 2010 6:10 am
Has thanked: 0 time
Been thanked: 0 time

Previous

Return to IBM Cobol

 


  • Related topics
    Replies
    Views
    Last post