View previous topic :: View next topic
|
Author |
Message |
sudhakar_lendave
New User
Joined: 21 Nov 2006 Posts: 48 Location: mumbai
|
|
|
|
Hi Friends,
this is my code.
Code: |
WORKING-STORAGE SECTION.
01 GROSS-PAY.
05 BASIC PIC 999V9 USAGE COMP VALUE 50.
05 ALLOW PIC 9(3).
01 WS-A PIC 999.
PROCEDURE DIVISION.
MOVE ZEROS TO GROSS-PAY.
MOVE BASIC TO WS-A.
DISPLAY 'WS-A ' WS-A.
STOP RUN.
|
i should get value of WS-A as 100 but it is not showing it 100.
instead i am getting 218.
i am not getting the reason behind it.
Sudhakar. |
|
Back to top |
|
|
amitava Warnings : 1 Active User
Joined: 30 Oct 2005 Posts: 186 Location: India
|
|
|
|
How it is possible man? You are first using the following code -
Code: |
MOVE ZEROS TO GROSS-PAY. |
And the variable declaration is -
Code: |
01 GROSS-PAY.
05 BASIC PIC 999V9 USAGE COMP VALUE 50.
05 ALLOW PIC 9(3).
|
So all the variables BASIC and ALLOW will be set to zeros. Pls clarify this first! |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
why do you think that you should have a value of 100? |
|
Back to top |
|
|
sudhakar_lendave
New User
Joined: 21 Nov 2006 Posts: 48 Location: mumbai
|
|
|
|
Sorry all for the confusion.
please refer this code
Code: |
WORKING-STORAGE SECTION.
01 GROSS-PAY.
05 BASIC PIC 999V9 USAGE COMP VALUE 50.
05 ALLOW PIC 9(3).
01 WS-A PIC 999.
PROCEDURE DIVISION.
MOVE ZEROS TO GROSS-PAY.
ADD 50 TO BASIC.
MOVE BASIC TO WS-A.
DISPLAY 'WS-A ' WS-A.
STOP RUN.
|
|
|
Back to top |
|
|
Craq Giegerich
Senior Member
Joined: 19 May 2007 Posts: 1512 Location: Virginia, USA
|
|
|
|
sudhakar_lendave wrote: |
Sorry all for the confusion.
please refer this code
Code: |
WORKING-STORAGE SECTION.
01 GROSS-PAY.
05 BASIC PIC 999V9 USAGE COMP VALUE 50.
05 ALLOW PIC 9(3).
01 WS-A PIC 999.
PROCEDURE DIVISION.
MOVE ZEROS TO GROSS-PAY.
ADD 50 TO BASIC.
MOVE BASIC TO WS-A.
DISPLAY 'WS-A ' WS-A.
STOP RUN.
|
|
MOVE ZEROS TO GROSS-PAY is an alphanumeric move so you are moving the character '0' to gross-pay not the number 0. Try MOVE ZEROS TO ALLOW instead. |
|
Back to top |
|
|
|