COBOL Simple Move
MOVE statement used to move the data from source to receiving field without any conditions.
In simple MOVE, sending field must be a constant/variable.
Sending field must be one.
Receiving filed must be a variable.
Receiving filed might be one or more.
In simple MOVE, sending field length is less than the receiving field the remaining length of the receiving field will be filled with ZEROES or SPACES based on the data type declaration.
In simple MOVE, the sending field length is greater than the receiving field the data will be moved to receiving data field based on the data type.
During group MOVE, if the sending data item has numeric then the receiving data item should be numeric and alphanumeric in the particular positions.
During group MOVE, if the sending data item has alphabetic/alpha-numeric then the receiving data item should be alphabetic/alpha-numeric in the particular positions.
MOVE sending-field TO receiving-field.
In the above example, VAR-1 declared as of length 4 and initialized with 2561.
Similarly VAR-2 is declared with length 6 and VAR-3 declared with length 2.
VAR-2 has the more size than VAR-1. After executing the below simple move statement, the additional two bytes will be filled with ZEROES hence the data type of VAR-2 is numeric.
MOVE VAR-1 TO VAR-2.
VAR-3 less in size than VAR-1. After executing the below simple move statement, from the VAR-1 the right most two bytes will be moved and remaining two bytes data in sending field was be ignored.
MOVE VAR-1 TO VAR-3.
If any questions on the above, post your queries on Cobol Discussion forum
COBOL Move Statement COBOL Group Move