View previous topic :: View next topic
|
Author |
Message |
swapnadeep.ganguly
Active User
Joined: 21 Mar 2007 Posts: 203 Location: India
|
|
|
|
Hi All,
I am using the following piece of code:
Code: |
IF (WS-TEMP1 <= WS-ACCT-LEN)
MOVE INP-OLD-ACCT-NUM(WS-ACCT-LEN:1) TO WS-ACCT-NUM
MOVE WS-ACCT-NUM TO WS-SWITCHES
DISPLAY 'ACCOUNT LENGTH: ' WS-ACCT-LEN
DISPLAY 'ACCOUNT NUMBER: ' WS-ACCT-NUM
DIVIDE WS-TEMP2 BY 2 GIVING WS-TEMP3
REMAINDER WS-TEMP4
IF (WS-TEMP4 = 0)
DISPLAY 'J%2 IS EQUAL TO ZERO'
EVALUATE TRUE
WHEN WS-NUM-ZERO
WS-TOTAL-SUM = WS-TOTAL-SUM + 0
DISPLAY 'SUM = 0: ' WS-TOTAL-SUM
WHEN WS-NUM-ONE
WS-TOTAL-SUM = WS-TOTAL-SUM + 2
DISPLAY 'SUM= 1: ' WS-TOTAL-SUM
END-EVALUATE
|
However,
I am getting a compilation error stating that Multiple "Evaluate" objects not seperated by "ALSO".
I have defined WS-NUM-ZERO as a conditional parameter.
Even if I use the following piece of code, still I get the same error:
Code: |
EVALUATE WS-ACCT-NUM
WHEN 0
WS-TOTAL-SUM = WS-TOTAL-SUM + 0
DISPLAY 'SUM = 0: ' WS-TOTAL-SUM
WHEN 1
WS-TOTAL-SUM = WS-TOTAL-SUM + 2
DISPLAY 'SUM= 1: ' WS-TOTAL-SUM
END-EVALUATE
|
Please let me know where I am going wrong. |
|
Back to top |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
Quote: |
COMPUTE WS-TOTAL-SUM = WS-TOTAL-SUM + 0 |
Dont you need a COMPUTE statement? |
|
Back to top |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6250 Location: Mumbai, India
|
|
|
|
Hi Arun,
I believe you hit on the nail - but why one would like to add zero to some variable . . . |
|
Back to top |
|
|
swapnadeep.ganguly
Active User
Joined: 21 Mar 2007 Posts: 203 Location: India
|
|
|
|
Hi,
Its a part of the logic that we are to use for the Luhn Algol...
Thanks for your solution.
On previous statements when we omitted the COMPUTE part, it was working fine. |
|
Back to top |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6250 Location: Mumbai, India
|
|
|
|
swapnadeep.ganguly wrote: |
On previous statements when we omitted the COMPUTE part, it was working fine. |
Sure? please post that code . . . |
|
Back to top |
|
|
swapnadeep.ganguly
Active User
Joined: 21 Mar 2007 Posts: 203 Location: India
|
|
|
|
Please be informed that the piece of code was not under any evaluate statement. |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
my, my, my, the things we learn. COMPUTE can be written implicitly.
Quote: |
Please be informed that the piece of code was not under any evaluate statement |
please be informed that such BS does not cause anyone to want to help. |
|
Back to top |
|
|
|