Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
Basic syntax errors in your post: (1) no level numbers on the variables, (2) B cannot have quotes around the value literal, (3) VALUE is not optional, and (4) periods are recommended.
I ran this code:
Code: |
05 A-FROM PIC X(04) VALUE 'ABCD'.
05 B-TO PIC S9(05) VALUE 10000.
05 A-TO PIC X(04) VALUE 'ABCD'.
05 B-FROM PIC S9(05) VALUE 10000.
/
PROCEDURE DIVISION.
S1000-MAIN SECTION.
MOVE A-FROM TO B-TO.
MOVE B-FROM TO A-TO.
DISPLAY 'A FROM: ' A-FROM.
DISPLAY 'A TO: ' A-TO.
DISPLAY 'B FROM: ' B-FROM.
DISPLAY 'B TO: ' B-TO. |
and got results of
Code: |
A FROM: ABCD
A TO: 1000
B FROM: 1000{
B TO: 0ABCD |
Which is precisely what you would expect by reviewing the rules for elementary MOVE statements in the COBOL Language Reference manual (link at the top of the page). |
|