IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Difference between COMPUTE and MOVE


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
abhicet2003

New User


Joined: 16 Nov 2005
Posts: 21

PostPosted: Sat May 13, 2006 10:52 pm
Reply with quote

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
View user's profile Send private message
ralph_v

New User


Joined: 07 Jul 2005
Posts: 27

PostPosted: Sun May 14, 2006 12:19 pm
Reply with quote

With compute , one can use ON SIZE ERROR clause to check for truncations.

END-EVALUATE is the scope terminator.
Back to top
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Sun May 14, 2006 8:48 pm
Reply with quote

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
View user's profile Send private message
prasadvrk

Active User


Joined: 31 May 2006
Posts: 200
Location: Netherlands

PostPosted: Wed May 31, 2006 6:51 pm
Reply with quote

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
View user's profile Send private message
lara

New User


Joined: 31 May 2006
Posts: 5

PostPosted: Thu Jun 01, 2006 1:24 pm
Reply with quote

The scope-terminator (End-Evaluate) enhances the readability of the program. It's the same case with END-IF.
Back to top
View user's profile Send private message
guptae

Moderator


Joined: 14 Oct 2005
Posts: 1208
Location: Bangalore,India

PostPosted: Wed Oct 11, 2006 11:13 am
Reply with quote

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
View user's profile Send private message
surya_pathaus

Active User


Joined: 28 Aug 2006
Posts: 110

PostPosted: Wed Oct 11, 2006 3:11 pm
Reply with quote

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
View user's profile Send private message
guptae

Moderator


Joined: 14 Oct 2005
Posts: 1208
Location: Bangalore,India

PostPosted: Wed Oct 11, 2006 3:14 pm
Reply with quote

Is there any other difference?
Back to top
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1353
Location: Israel

PostPosted: Wed Oct 11, 2006 3:39 pm
Reply with quote

And this is how you introduce a new bug in your program: icon_confused.gif
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
View user's profile Send private message
surya_pathaus

Active User


Joined: 28 Aug 2006
Posts: 110

PostPosted: Wed Oct 11, 2006 3:43 pm
Reply with quote

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
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Thu Oct 12, 2006 7:07 am
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts COBOL - Move S9(11)v9(7) COMP-3 to -(... COBOL Programming 5
No new posts Timestamp difference and its average ... DB2 11
No new posts Difference when accessing dataset in ... JCL & VSAM 7
No new posts How to move the first field of each r... DFSORT/ICETOOL 5
No new posts What is the difference between Taskty... Compuware & Other Tools 2
Search our Forums:

Back to Top