Highlighted
Absent Member.
Absent Member.
6541 views

set encoding ECLIPSE-Variables view

Jump to solution

Hi,

anyone found solution for this problem?

I have set to UTF-8, alphanumerics are shown with wrong encoding.

 

0 Likes
1 Solution

Accepted Solutions
Highlighted
Micro Focus Expert
Micro Focus Expert

RE: set encoding ECLIPSE-Variables view

Jump to solution

A colleague of mine found that if he changes the file type from line sequential and adds the charset"ebcdic" directive to my test program then the results are the same as what you are experiencing.

This is because files of type line sequential are automatically converted whereas sequential files are not.
If you are setting charset"ebcdic" directive then the files are assumed to be in ebcdic encoding and not ansi.

I can get this to read correctly by adding the code-set clause to the files fd and assign it to the ASCII alphabet:

Example:

     $set charset"ebcdic"
      program-id. testenv as "testenv".
      environment division.
      configuration section.
      special-names.
         alphabet ascii-sequence is ASCII.
      input-output section.
          select test-file assign to "c:\temp\testfile.dat"            
                           organization is sequential
                           file status is file-status.
      data division.
      fd test-file
         code-set is ascii-sequence.
      01 test-record   pic x(80).
      working-storage section.
      01 file-status   pic x(2)  value spaces.
      01 my-field      pic x(80).
      procedure division.
          open input test-file
          display file-status
          read test-file
          move test-record to my-field
          display my-field
          close test-file
          goback.
      end program testenv.

View solution in original post

0 Likes
13 Replies
Highlighted
Micro Focus Expert
Micro Focus Expert

RE: set encoding ECLIPSE-Variables view

Jump to solution

Where exactly are you setting the character set encoding to UTF-8, under Project Properties, etc.?

When I set the encoding under the project properties to UTF-8, I do not see the same problem that you are experiencing.

Under which OS are you running?

Thanks.

0 Likes
Highlighted
Absent Member.
Absent Member.

RE: set encoding ECLIPSE-Variables view

Jump to solution

Im running Windows XP. DOS cp is 850. I've tried with several encodings(utf8, cp1252, iso-8..) in Project->Resources, and also in Eclipse->Workspace settings, since Project->encoding is inherited. 

0 Likes
Highlighted
Micro Focus Expert
Micro Focus Expert

RE: set encoding ECLIPSE-Variables view

Jump to solution

I've also tried setting cp850 and UTF-8 and also don't see the same issue.  Having said that, I'm using Widnows 7 and not XP.  

Just to clarify matters, what product version are you using?

I also assume that you're on a German localised machine (not that it should make a difference, but it's good to be sure)

Regards

0 Likes
Highlighted
Micro Focus Expert
Micro Focus Expert

RE: set encoding ECLIPSE-Variables view

Jump to solution

A couple of questions for you...

Is the data in these variables being read from a file?

If yes, then what character set is being used in the file?

Are you specifying the directive CHARSET"EBCDIC"?

Does this occur when debugging one of the example programs or only when debugging one of your projects?

Thanks.

0 Likes
Highlighted
Absent Member.
Absent Member.

RE: set encoding ECLIPSE-Variables view

Jump to solution

Hi Chris,

yes, machine is localised for German, and product is Visual COBOL for Eclipse, Version: 2.1.75.v201209140610.

0 Likes
Highlighted
Absent Member.
Absent Member.

RE: set encoding ECLIPSE-Variables view

Jump to solution

Chris,

file is ANSI, as shown when opened with Notepad+.

I havn't tried with example project(s).

0 Likes
Highlighted
Absent Member.
Absent Member.

RE: set encoding ECLIPSE-Variables view

Jump to solution

Attached is input file, original extension is .dat

0 Likes
Highlighted
Micro Focus Expert
Micro Focus Expert

RE: set encoding ECLIPSE-Variables view

Jump to solution

I created a demo project and I can read your file and the variables window looks correct using the default charset for the system.

I think that this is either related to your environment or is something specific in your project.

Can you please create a new project and use the following source to test this with?
Change the filename in the select statement to match you own location.

program-id. testenv as "testenv".
environment division.
input-output section.
     select test-file assign to "c:\temp\testfile.dat"            
                             organization is line sequential
                             file status is file-status.
data division.
fd test-file.
01 test-record  pic x(80).
working-storage section.
01 file-status  pic x(2)  value spaces.
01 my-field     pic x(80).
procedure division.
 
    open
input test-file
     display file-status
     read test-file
     move test-record to my-field
    
display my-field
    
close test-file
    
goback.

end
program testenv.

0 Likes
Highlighted
Micro Focus Expert
Micro Focus Expert

RE: set encoding ECLIPSE-Variables view

Jump to solution

A colleague of mine found that if he changes the file type from line sequential and adds the charset"ebcdic" directive to my test program then the results are the same as what you are experiencing.

This is because files of type line sequential are automatically converted whereas sequential files are not.
If you are setting charset"ebcdic" directive then the files are assumed to be in ebcdic encoding and not ansi.

I can get this to read correctly by adding the code-set clause to the files fd and assign it to the ASCII alphabet:

Example:

     $set charset"ebcdic"
      program-id. testenv as "testenv".
      environment division.
      configuration section.
      special-names.
         alphabet ascii-sequence is ASCII.
      input-output section.
          select test-file assign to "c:\temp\testfile.dat"            
                           organization is sequential
                           file status is file-status.
      data division.
      fd test-file
         code-set is ascii-sequence.
      01 test-record   pic x(80).
      working-storage section.
      01 file-status   pic x(2)  value spaces.
      01 my-field      pic x(80).
      procedure division.
          open input test-file
          display file-status
          read test-file
          move test-record to my-field
          display my-field
          close test-file
          goback.
      end program testenv.

View solution in original post

0 Likes
Highlighted
Absent Member.
Absent Member.

RE: set encoding ECLIPSE-Variables view

Jump to solution

Chris,

thanks for tip.

I find hard to make changes in source of the programms(minimum two lines - per program + per FD) just in order to compile&run, is there silverbullet?

Our additional settings are : DIALECT(ENTCOBOL) INITCALL"ORASQL8" ASSIGN "EXTERNAL" nowarning copyext",cpy" hostarithmetic PERFORM-TYPE"OSVS" signfixup IDXFORMAT(8) nolist p(cobsql) CSQLT=ORACLE8 MAKESYN VERBOSE KEEPCBL END-C COMP5=NO  p(cp) ENDP ENDP

Thanks,

Alex

0 Likes
Highlighted
Micro Focus Expert
Micro Focus Expert

RE: set encoding ECLIPSE-Variables view

Jump to solution

I am not sure what you are asking for here.

You can set these directives at the project level by right clicking on the project name and selecting properties:

Or you could place the directives in a directives file, i.e. cobol.dir and then specify the use directive to point to this file:

use"c:\mydirtectives\cobol.dir"

Is this what you are looking for?

 

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.