Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Difference between COMPUTE and MOVE

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: Difference between COMPUTE and MOVE
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    Post subject: Re: COMPUTE and MOVE
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    Post subject:
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    Post subject: Difference between COMPUTE and MOVE
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    Post subject:
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: 1187
Location: Bangalore,India

PostPosted: Wed Oct 11, 2006 11:13 am    Post subject:
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    Post subject: Re: Difference between COMPUTE and MOVE
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: 1187
Location: Bangalore,India

PostPosted: Wed Oct 11, 2006 3:14 pm    Post subject:
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: 1228
Location: Israel

PostPosted: Wed Oct 11, 2006 3:39 pm    Post subject:
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    Post subject: Re: Difference between COMPUTE and MOVE
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    Post subject:
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    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts ROUNDED Problem with COMPUTE statement shalem COBOL Programming 11 Thu Feb 09, 2017 8:16 pm
No new posts DB2 9.1.0 not move values to Host-Var... Miguel Fernandez DB2 8 Wed Jan 25, 2017 8:24 pm
No new posts DB2 9.1.0 not move values to Host-Var... Miguel Fernandez DB2 0 Wed Jan 25, 2017 8:23 pm
No new posts DB2 9.1.0 not move values to Host-Var... Miguel Fernandez DB2 0 Wed Jan 25, 2017 8:21 pm
No new posts Difference between TWALENG and TWASIZE Arunkumar Chandrasekaran CICS 3 Tue Jan 03, 2017 12:57 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us