Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HEX / Text Source Code Editing #183

Open
davidkcoblentz opened this issue Nov 11, 2021 · 11 comments
Open

HEX / Text Source Code Editing #183

davidkcoblentz opened this issue Nov 11, 2021 · 11 comments
Labels
enhancement New feature or request

Comments

@davidkcoblentz
Copy link

davidkcoblentz commented Nov 11, 2021

Description of the enhancement requested

Environment

Version: 1.62.0 (user setup)
Commit: b3318bc0524af3d74034b8bb8a64df0ccf35549a
Date: 2021-11-03T15:23:01.379Z
Electron: 13.5.1
Chrome: 91.0.4472.164
Node.js: 14.16.0
V8: 9.1.269.39-electron.0
OS: Windows_NT x64 10.0.17763

Text / Hex Editing View

I would like to see the source that I am editing with the hex equivalent below each character like the mainframe has in it's editor. An example is seen below. I understand there are dump style extensions but I would prefer a hex editor like the mainframe has. There are times when coding MFS or assembler or even COBOL programs that may have embedded hex values, that are non-displayable in the source.

Hex Editing MFS Source example that has embedded hex values
image

MFS Source code that contains Hex values
image

@davidkcoblentz davidkcoblentz changed the title HEX HEX / Text Source Code Editing Nov 11, 2021
@FALLAI-Denis
Copy link

FALLAI-Denis commented Nov 15, 2021

Hi,

Personally, I think the use of hex characters directly in the sources should be avoided.
This already poses problems on the mainframe if the encoding are incorrectly declared. But things are worse with the EBCIDIC / UTF8 (or ASCII) conversions that occur for work in VS Code.
After conversion, the characters can lose all meaning.

VS Code, and Z Open Editor, is a source code editor (source programs editor). It is not a data file editor. The files handled must only use displayable characters.

You must use the X'nn' syntax in COBOL, or equivalent in other languages, to introduce hex values in the source codes.

However, EBCDIC characters x'4F ', x'6F' should be converted to UTF8 (or ASCII) and displayed correctly in VS Code / Z Open Editor. For me, they are converted to x'7C', x'3F' in UTF8 / ASCII.

There seems to be another problem with your configuration.
Is the encoding conversion correctly set at Zowe CLI?
Is the correct encoding declared in VS Code?
Auto detection problem of the encoding in VS Code?
Try "reopen with encoding" in VS Code.

Otherwise to see the values of hexa or non-displayable characters in VS Code, see the extension Gremlins tracker for Visual Studio Code.

@IBM IBM deleted a comment from kkrein Nov 16, 2021
@IBM IBM deleted a comment from kkrein Nov 16, 2021
@phaumer
Copy link
Member

phaumer commented Nov 16, 2021

Yes, on the VS Code side we are working with UTF-8 only. Conversions are handled for us by z/OSMF or RSE API. Microsoft has a Hex extension as well, but this will not help much here I guess.

I would not think that we would try this any time soon for Z Open Editor. As you might know we are also partnering with other companies for data editing for our other editors, but unfortunately VS Code support is behind.

@phaumer phaumer added the enhancement New feature or request label Nov 16, 2021
@davidkcoblentz
Copy link
Author

Thank you both so much for your quick answers! I see your point that it is a source editor. I am still checking out why the original developers put non-displayable bytes of data in the MFS. I will document it here if I come to understand why. I am suspecting MFS 3270 attribute bytes but am still checking.

I also noticed when I brought my REXX source code into VS Code from the mainframe that the '|' (vertical bar), used as the logical OR operator, is not translating properly so it shows as a non-displayable character. I am also investigating to see if I should be using a different code-page other than English 037 to ASCII 437 when downloading from the mainframe.
image

@FALLAI-Denis
Copy link

FALLAI-Denis commented Nov 17, 2021

Hi,

For EBCDIC / UTF8 character conversions, see
The ebcdic x'CA 'character (IBM-1147) is missing after transfer with ZOWE Explorer (with encoding 1147) / soft hyphen x'AD' not rendered by Chromium

See also if you have the PTFs on z/OSMF which addresses the character conversions problem (by past z/OSMF only worked with IBM-1047, ccsid USS), and if you also have a version of Zowe CLI which supports character conversions (--encoding).

@phaumer
Copy link
Member

phaumer commented Nov 17, 2021

For RSE API users there is documentation on conversion options here: https://ibm.github.io/zopeneditor-about/Docs/mvs_encoding.html If you find any conversion problems with RSE let us know here as well.

@davidkcoblentz
Copy link
Author

Thank you! I just realized you had questions above that I didn't answer.
Questions:
There seems to be another problem with your configuration.
Is the encoding conversion correctly set at Zowe CLI? We are in the process of configuring zOSMF and getting ZOWE connectivity. I am currently downloading each source member with my 3270 Terminal emulator Aviva. I will address this when we get zOSMF / Zowe configured
Is the correct encoding declared in VS Code? Same as above
Auto detection problem of the encoding in VS Code? Same as above
Try "reopen with encoding" in VS Code. # Same as above

@FALLAI-Denis
Copy link

FALLAI-Denis commented Nov 17, 2021

Hi @davidkcoblentz

This is probably the origin of the problem.
When you download files, be sure to convert encoding from the ccsid used for your mainframe (the ccsid defined in your 3270 emulator) to UTF8 (without bom).

If you convert from EBCDIC IBM-037 to ASCII IBM-437, it's an error.
If you don't have UTF8, try Windows-1252 in replacement of UTF8.

If you use "ind$file" look at parameters of your emulator, (ftp should be a better solution).

I think you can use Zowe CLI "zftp" without z/osmf. Otherwise use client ftp of your workstation.

@davidkcoblentz
Copy link
Author

davidkcoblentz commented Nov 17, 2021 via email

@FALLAI-Denis
Copy link

PS :

If you want to do an FTP transfer directly with z/OS, you may encounter problems because the z/OS FTP server does not accept to switch from single-byte encoding (IBM-037) to multibyte encoding (UTF-8 / IBM-1208).

One solution would be to transfer via FTP from IBM-037 to IBM-1252, then apply a local transformation to UTF8, for example by opening the transferred file in VS Code in Windows-1252 and then saving it in UTF-8.

@FALLAI-Denis
Copy link

FALLAI-Denis commented Dec 1, 2021

Hi @davidkcoblentz, @phaumer

I remain convinced that we cannot transfer a file containing non-displayable characters (binary data or packaged decimal) and apply an encoding translation to it, (go from EBCDIC to UTF8 and vice versa).

Nevertheless, the editing of (small) data files remains a common need, (for large data files it is better to turn to a specific tool which is no longer direct file editing).

For this, I made two proposals for the development of the Zowe Explorer for VS Code extension, which you could consider and support by voting:

Thanks.

@davidkcoblentz
Copy link
Author

davidkcoblentz commented Dec 1, 2021 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants