View previous topic :: View next topic
|
Author |
Message |
abhicet2003
New User
Joined: 16 Nov 2005 Posts: 21
|
|
|
|
Hi all,
1. Please tell me the difference between
COMPUTE and MOVE?
2.Why EVALUATE need END-EVALUATE mandatory? I studied that EVALUATE doesn't need a break statement and whenever it find a match it will automatically come out of the condition. Then what is the purpose of END-EVALUATE?
Thanks |
|
Back to top |
|
|
ralph_v
New User
Joined: 07 Jul 2005 Posts: 27
|
|
|
|
With compute , one can use ON SIZE ERROR clause to check for truncations.
END-EVALUATE is the scope terminator. |
|
Back to top |
|
|
mmwife
Super Moderator
Joined: 30 May 2003 Posts: 1592
|
|
|
|
And don't forget ROUNDED.
MOVE (I think) allows mixed (num/alphanum) sending/recving flds in some circumstances; COMPUTE doesn't.
Otherwise MOVE/COMPUTE are equivalent. They generate identical code.
EVAL: I'd guess, since it's a new feature and scope terminators were introed at the same time, there's no need for backward compatiblity. |
|
Back to top |
|
|
prasadvrk
Active User
Joined: 31 May 2006 Posts: 200 Location: Netherlands
|
|
|
|
Using COMPUTE, you can do nemric operations like addition, subtraction, multiplication and division but using MOVE you can not do neither of these
END-EVALUATE is optional as far as I know. Same applies to any of the scope terminators. |
|
Back to top |
|
|
lara
New User
Joined: 31 May 2006 Posts: 5
|
|
|
|
The scope-terminator (End-Evaluate) enhances the readability of the program. It's the same case with END-IF. |
|
Back to top |
|
|
guptae
Moderator
Joined: 14 Oct 2005 Posts: 1208 Location: Bangalore,India
|
|
|
|
Hi There,
Would u please tell me what is exact difference between move & compute statement?
MOVE A TO B
OR COMPUTE A=B |
|
Back to top |
|
|
surya_pathaus
Active User
Joined: 28 Aug 2006 Posts: 110
|
|
|
|
Hi Ekta,
Move A to B and compute a=b both acts like same.
difference is
MOVE statement carries out the assignment with truncation. Therefore, if the size error is needs to be detected, COMPUTE will be preferred over MOVE. The ON SIZE ERROR phrase of COMPUTE statement detects size-overflow. |
|
Back to top |
|
|
guptae
Moderator
Joined: 14 Oct 2005 Posts: 1208 Location: Bangalore,India
|
|
|
|
Is there any other difference? |
|
Back to top |
|
|
Marso
REXX Moderator
Joined: 13 Mar 2006 Posts: 1353 Location: Israel
|
|
|
|
And this is how you introduce a new bug in your program:
Quote: |
Move A to B and compute a=b both acts like same. |
In "MOVE A TO B", B is modified, A is unchanged
In "COMPUTE A=B", B is unchanged, it is A who is modified!! |
|
Back to top |
|
|
surya_pathaus
Active User
Joined: 28 Aug 2006 Posts: 110
|
|
|
|
Hi Marso,
Quote: |
In "MOVE A TO B", B is modified, A is unchanged
In "COMPUTE A=B", B is unchanged, it is A who is modified!!
|
I mean to say Two statements acts like move. |
|
Back to top |
|
|
mmwife
Super Moderator
Joined: 30 May 2003 Posts: 1592
|
|
|
|
Back to EVAL. If you use an EVAL stmt within an IF stmt (for example) you need the END-EVAL, if you don't, you can end it w/a period (.).
But you can't just let it hang there without either of those two. |
|
Back to top |
|
|
|