Moving national data items to alphanumeric data items
You cannot move a national data item to an alphanumeric data item.
When you use IBM®
COBOL for Linux® on x86 to compile source code that
contains a
MOVE
statement from a national data item to an alphanumeric data item,
you will
receive the error message in the following example:$ cat tcNational2Alphanumeric.cbl
000010 IDENTIFICATION DIVISION.
000020 PROGRAM-ID. ND2AD.
000030 ENVIRONMENT DIVISION.
000040 CONFIGURATION SECTION.
000050
000060 DATA DIVISION.
000070 WORKING-STORAGE SECTION.
000080
000090 01 DataNational PIC N(100).
000100
000110 01 DataAlphanumeric PIC X(100).
000120
000130 PROCEDURE DIVISION.
000140 MOVE DataNational TO DataAlphanumeric.
000150 STOP-MY-PROGRAM.
000160 STOP RUN.
$ cob2 -o tcNational2Alphanumeric tcNational2Alphanumeric.cbl IBM COBOL for Linux 1.2.0 compile started 0LineID Message code Message text 14 IGYPA3005-S "DATANATIONAL (NATIONAL ITEM)" and "DATAALPHANUMERIC (ALPHANUMERIC)" did not follow the "MOVE" statement compatibility rules. The statement was discarded. -Messages Total Informational Warning Error Severe Terminating 0Printed: 1 1 End of compilation 1, program ND2AD, highest severity: Severe. Return code 12
According to Standard COBOL 2002, you cannot move a national data item to an alphanumeric data item.
Change your COBOL source to follow Standard COBOL 2002.