Page 1 of 1

Query with unsigned variable.

PostPosted: Thu Mar 27, 2008 3:28 pm
by Asad
Hi,
I have a small code. Am not sure about the value of the variable. :

01 NUM1 PIC 9 VALUE ZERO.
Step1: ADD -2 TO NUM1

Execute Step1 3 TIMES



What will be the value of NUM1?

Please give clarification also.
Thanks

Re: Query with unsigned variable.

PostPosted: Thu Mar 27, 2008 7:35 pm
by arunprasad.k
Did you code this and ran?? What did you get in your output??

Didn't you get 2 as the result??

Arun.

Re: Query with unsigned variable.

PostPosted: Fri Mar 27, 2009 7:28 am
by qykong1986
I tried it on mainframe.
05 WS-CHANGE-OUT         PIC 9 VALUE ZERO.
...................
     ADD -2 TO WS-CHANGE-OUT.               
     DISPLAY 'FIRST STEP ' WS-CHANGE-OUT.   
     ADD -2 TO WS-CHANGE-OUT.               
     DISPLAY 'SECOND STEP ' WS-CHANGE-OUT.   
     ADD -2 TO WS-CHANGE-OUT.               
     DISPLAY 'THIRD STEP' WS-CHANGE-OUT.     

And the result :
FIRST STEP 2     
SECOND STEP 0     
THIRD STEP 2