When using the MOVE statement in COBOL, what happens if the source field is larger than the receiving field?

  • An error is generated, and the program terminates
  • The MOVE statement automatically resizes the receiving field to match the source field
  • The MOVE statement ignores the excess characters in the source field
  • Truncation occurs, and only the leftmost characters that fit in the receiving field are moved
In COBOL, if the source field is larger than the receiving field during the MOVE statement, truncation occurs. Only the leftmost characters that fit in the receiving field will be moved, and the excess characters are ignored. It's essential to ensure field sizes match or handle truncation appropriately.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *