Skip to main content

Compile error on Linux with a source containing special characters in literal

  • February 15, 2013
  • 0 replies
  • 0 views

Problem:

When moving a source that contains special characters from a different platform (i.e. Windows, HP...) to Linux you may find that you get compilation errors in those lines.

For example the following code:

       working-storage section.

        01  m2          pic x(02) value "m²".

       PROCEDURE DIVISION.

(where the characters in the non-numeric literal are U 006D and U 00B2) could produce the following compilation error:

    14  working-storage section.

    15  01  m2          pic x(02) value "mý".

    16

*1004-E****************************************************************(   0)**

**    Continuation character expected. End of literal assumed.

    17 PROCEDURE DIVISION.

*1014-E*********                                                       (   1)**

**    Period missing. Period assumed.

*1007-E*********                                                       (   1)**

**    VALUE literal size 31 > data item size 2. Literal truncated.

Resolution:

By default Linux uses UTF-8 as a character set. Typing

export LANG=en_GB

(or the code corresponding to your own language) would stop the compilation errors.

Old KB# 4539