Moving x(3) to S9(3) COMP.
Posted: Fri Feb 24, 2006 12:11 pm
Hi,
We are using "IBM Enterprise COBOL for z/OS 3.3.1" at our shop. I used the following code and surprisingly it did not give any compilation error or abend.
After executing the job I got the below result in the sysout:
ABCDE - display ws-num-1
12345 - display ws-num-2
Can you please tell me why?
We are using "IBM Enterprise COBOL for z/OS 3.3.1" at our shop. I used the following code and surprisingly it did not give any compilation error or abend.
Code: Select all
IDENTIFICATION DIVISION.
PROGRAM-ID. COMP01.
ENVIRONMENT DIVISION.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 WS-NUM-1 PIC X(05).
01 WS-NUM-2 PIC S9(05) COMP.
PROCEDURE DIVISION.
MAIN-PARA.
MOVE 'ABCDE' TO WS-NUM-1.
DISPLAY WS-NUM-1.
MOVE WS-NUM-1 TO WS-NUM-2.
DISPLAY WS-NUM-2.
STOP RUN.
ABCDE - display ws-num-1
12345 - display ws-num-2
Can you please tell me why?