View previous topic :: View next topic
|
Author |
Message |
services
New User
Joined: 20 May 2009 Posts: 38 Location: India
|
|
|
|
HI EVERYONE,
I HAVE
var1 PIC S9(11)V9(04) VALUE 0.
var2 PIC S9(11)V9(04) VALUE 0.
var3 PIC S9(11)V9(04) VALUE 0.
is it possible to add var1 and var2 and giving var3?
var3=var1+var2
if so,how to code it?
when i add i am getting 0 values to var3. |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8697 Location: Dubuque, Iowa, USA
|
|
|
|
Show your exact code, please.
If var1 has a value of zero, and you add a zero in var2 to it, you SHOULD get a value of zero in var3. Based on what you've posted, there's no problem here.
Code: |
COMPUTE VAR3 = VAR1 + VAR2 |
|
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
I can recall using the COMPUTE statement back in the dark and distant past when I last played COBOL.
COMPUTE VAR3 = VAR1 + VAR2. |
|
Back to top |
|
|
Craq Giegerich
Senior Member
Joined: 19 May 2007 Posts: 1512 Location: Virginia, USA
|
|
|
|
services wrote: |
HI EVERYONE,
I HAVE
var1 PIC S9(11)V9(04) VALUE 0.
var2 PIC S9(11)V9(04) VALUE 0.
var3 PIC S9(11)V9(04) VALUE 0.
is it possible to add var1 and var2 and giving var3?
var3=var1+var2
if so,how to code it?
when i add i am getting 0 values to var3. |
Have you looked in the cobol manuals?
Code: |
ADD VAR1 TO VAR2 GIVING VAR3.
or
COMPUTE VAR3 = VAR1 + VAR2.
|
If var1 and var2 are zero then var3 would be zero! |
|
Back to top |
|
|
Itanium
Active User
Joined: 22 Jan 2006 Posts: 114 Location: India
|
|
|
|
opened this question out of curiosity... still wondering why such question was raised and surprisingly there were 3 replies. hari, you are lucky. |
|
Back to top |
|
|
services
New User
Joined: 20 May 2009 Posts: 38 Location: India
|
|
|
|
i had doubt for adding two PIC S9(11)V9(04) and i got the result is zero, that is the reason i raised this question.. |
|
Back to top |
|
|
Itanium
Active User
Joined: 22 Jan 2006 Posts: 114 Location: India
|
|
|
|
still you are fuzzy, can you post the code relvant to this for others to get into a conclusion and find a solution. |
|
Back to top |
|
|
services
New User
Joined: 20 May 2009 Posts: 38 Location: India
|
|
|
|
Code: |
MOVE WS-RECEIVING-ORP TO WS-COST-POOL.
COMPUTE WS-SET-MATERIAL-COST ROUNDED =
RECEIVING-BASE OF WS-SCHEDULE-TABLE
(DLV-IDX, CUST-IDX, RATE-IDX, SHOP-IDX, MATL-IDX).
MOVE 'M' TO WS-WRITE-COST-TYPE-SW.
PERFORM 7000-WRITE-TO-COST-FILE THRU 7000-EXIT.
|
above is the code
when i receive the WS-RECEIVING-ORP = 697
i have to add the price of WS-RECEIVING-ORP = 523 and WS-RECEIVING-ORP = 512 and replace the price values
WS-RECEIVING-ORP = 697 |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8697 Location: Dubuque, Iowa, USA
|
|
|
|
The benefits of posting actual code instead of interpreting! Conflicting with the original post, what you posted has no additions in it, so the question becomes exactly what do you think this code is doing? |
|
Back to top |
|
|
|