What is the difference in Natural when it comes to MOVE and (=) in statements?

StackOverflow https://stackoverflow.com/questions/22849303

  •  27-06-2023
  •  | 
  •  

Question

I have only been programming in Natural for a couple of weeks over the course of a couple of years. I only do enough of it to get myself by.

Question: What is the difference between the MOVE a TO b and the a = b?

Code:

  MOVE A TO B
  MOVE D TO Y

Or

  A = B
  C = D      
Was it helpful?

Solution 2

I think from what I can remember of Natural that basically they are they same. But I also remember that there are some difference.

For the most part I used = just because if you are using C++ that is a more common way of looking at it.

    MOVE Your-Value TO Another-Value

is for the most part equal to

    Another-Value = Your-Value

But I think where it is different slightly is as to what computations that you can and cannot perform with the = rather than the MOVE. You can MOVE to multiple values like below but the = can only move to a single variable.

    MOVE A TO C D BaseBallScore

This is very useful if you have to move a lot of values at one time to several different counters but you could move one at a time. Like below

    MOVE A TO C
    MOVE A TO D
    MOVE A TO BaseBallScore

There are also some functions that you can use with the MOVE that make it a nice option. Such as rounding a number

    MOVE ROUNDED Value To NewValue <-- ROUNDED can take different parameters

Here is another function SUBSTRING that will let you move a part of a string to another part of the string. Normally I use the = just because that is how the boss does it but the MOVE statement gives a programmer a bit more flexibility.

    MOVE SUBSTRING(#A,5,8) TO #B

An online reference for the move is located here:

http://documentation.softwareag.com/natural/nat638vms/print/sm.pdf

OTHER TIPS

If you are using a Licensed product, you should have access to documentation at your site.

Software AG are the vendor. I found this with a simple internet search: http://documentation.softwareag.com/natural/nat638vms/general/print.htm

That is a manual for Natural on OpenVMS. It makes references to the Mainframe version, and looks good enough to answer your question.

This seems to be, at the simplest level, they are the same. However, if you want to do a calculation, you need the COMPUTE =, that can't be done with MOVE. There are various formats of the MOVE statement.

I have never used Natural, and can't test it. You have access to the product, that along with documentation will allow you to provide a full answer for yourself.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top