MOVE in COBOL, no abend.
Posted: Mon May 11, 2015 4:54 pm
Hi,
I'm using IBM Enterprise COBOL and working with the below code for testing:.I expected a compilation error or an abend but nothing of that sort happened. Can someone tell why this happens?
The result is:
WS-VAR-A - ABCDE
WS-VAR-B - 12345
I'm using IBM Enterprise COBOL and working with the below code for testing:.I expected a compilation error or an abend but nothing of that sort happened. Can someone tell why this happens?
Code: Select all
IDENTIFICATION DIVISION.
PROGRAM-ID. TESTPGM.
ENVIRONMENT DIVISION.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 WS-VAR-A PIC X(05).
01 WS-VAR-B PIC S9(05) COMP.
PROCEDURE DIVISION.
MAIN-PARA.
MOVE 'ABCDE' TO WS-VAR-A.
DISPLAY WS-VAR-A.
MOVE WS-VAR-A TO WS-VAR-B.
DISPLAY WS-VAR-B.
GOBACK.
The result is:
WS-VAR-A - ABCDE
WS-VAR-B - 12345