../courses.php
COBOL
COBOL105
3
Move Data
COBOL uses MOVE to copy data from one field into another field.
What does MOVE do in COBOL?
MOVE copies a value from one COBOL field or literal into another COBOL field.
Business programs constantly move information.
A customer name may move into a print field.
A status value may move into a flag.
A calculated value may move into a report field.
MOVE is one of the most common COBOL verbs.
Moving a customer name
DATA DIVISION.
WORKING-STORAGE SECTION.
01 CUSTOMER-NAME PIC X(30).
01 PRINT-NAME PIC X(30).
PROCEDURE DIVISION.
MOVE "MAYA SINGH" TO CUSTOMER-NAME.
MOVE CUSTOMER-NAME TO PRINT-NAME.
DISPLAY PRINT-NAME.
STOP RUN.
CUSTOMER-NAME is a storage field.
PRINT-NAME is another storage field.
The first MOVE places text into CUSTOMER-NAME.
The second MOVE copies CUSTOMER-NAME into PRINT-NAME.
DISPLAY outputs the final print field.
Copying
MOVE copies business data between fields.
Reports
Data is often moved into report fields.
Flags
Status values are often moved into control fields.
Maintenance
Reading MOVE statements helps trace where data goes.
Using a field before filling it
Move first, display after
MOVE CUSTOMER-NAME TO PRINT-NAME.
DISPLAY PRINT-NAME.
Ask ChatGPT: "Trace every MOVE statement and tell me where each value ends up."
Create two text fields.
Move a literal into the first field.
Move the first field into the second field.
Display the second field.
Explain why MOVE matters in business programs.
Reading MOVE backwards.
Displaying a field before it has useful data.
Moving text into a field that expects numbers.
Losing track of where data came from.
Thinking MOVE deletes the original value.
Use MOVE to copy data between COBOL fields.
Login - Jit4All
Login
Welcome back to Jit4All