Repository navigation
Fix members failing to open when SRCDTA contains NUL bytes - #3510
Merged
Merged
Conversation
Legacy members can carry x'00' bytes in SRCDTA (old tooling wrote
NUL-terminated strings into full-length CHAR fields). The byte converts
cleanly through CCSID to U+0000, and a single NUL makes VS Code's text
model refuse to display the document ('binary or unsupported encoding').
Translate x'00' to blank in the SRCDTA SELECT on the host, so the
downloaded text is clean before it leaves Db2.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Opening certain legacy source members fails with VS Code showing:
Cause
Some legacy members carry
x'00'bytes inSRCDTA— old tooling wrote NUL-terminated strings into full-length CHAR fields (e.g. RPG III template header lines packed with+to the full record length, ending withx'00'). Or in some cases, early versions of VSCODE included a X'00' in some cases.The byte converts cleanly through CCSID to
U+0000, and a single NUL in the text stream makes VS Code's text model classify the document as binary and refuse to display it.Verified on a member where
HEX(RIGHT(SRCDTA, 4))=4E4E4E00— the NUL is the last byte of the record on the host.Fix
Apply
TRANSLATE(srcdta, ' ', x'00')in the SRCDTA SELECT used by the source-date download path, mapping NUL to blank on the host. Applied to both the CCSID-65535 CAST branch and the plain column branch.Notes
CPYSRCFpreserves the issue so this fix resolves the issue of openning and cleans up that trailing X'00' when it exists.