View previous topic :: View next topic
|
Author |
Message |
shrivatsa Warnings : 1 Active User
Joined: 17 Mar 2006 Posts: 174 Location: Bangalore
|
|
|
|
Hi,
COPYBOOK Variable
ACCOUNT_DET is decalred as PIC X(14). For this variable the Input File contains values -110.25,+220.44,-199.88 and so on...
I want to read this file and do the sum of all the values. Please help me out for this.
I am getting SOC7 for this. The statement which is in bold is giving SOC7 Error. I am in confusion of how to decalre this type of varibale and how to resolve this type of problem.
I have decalred a Working storage variable Y PIC S9(12)V99.
and Z PIC S9(12)V99.
MOVE ACCOUNT_DET TO Y.
COMPUTE Z=Z+Y
Thanks in Advance |
|
Back to top |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
Try: COMPUTE Z = Z + FUNCTION NUMVAL(ACCOUNT_DET). |
|
Back to top |
|
|
munikumar Currently Banned New User
Joined: 18 Apr 2007 Posts: 24 Location: India
|
|
|
|
You can also use redefine for ACCOUNT_DET. I mean, you redefine ACCOUNT_DET and use that redefined item to move into Y.
Because, you are getting S0C7 on MOVE statement, the above FUCTION NUMVAL will not work for you. The control will not come to this statement at all.
Regards
Munikumar G |
|
Back to top |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
munikumar wrote: |
You can also use redefine for ACCOUNT_DET. I mean, you redefine ACCOUNT_DET and use that redefined item to move into Y. |
Redefine will fail, it is the embedded decimal point and sigh that are causing the S0C7.
Quote: |
Because, you are getting S0C7 on MOVE statement, the above FUCTION NUMVAL will not work for you. The control will not come to this statement at all. |
Wrong, numval is the only (simple) answer. |
|
Back to top |
|
|
|