codefori/vscode-ibmi

Error listing Source Files Starting with Ñ

Opened this issue · 30 comments

Type: Bug

In the new version of Code for i, 2.13.0 when navigating in the Object Browser, it is not possible to view the members of source files that start with the letter Ñ. This issue did not exist in the previous version.

Steps to Replicate the Error:

Update to the latest version of Code for i. 2.13.0
Create a source file that starts with the letter Ñ (from IBM i).
Create a member for the source file (from IBM i).
Create a filter for this source in the VS Code
Attempt to view the members of the source file that starts with Ñ from the Object Browser.

Best regards,

Extension version: 2.13.0
VS Code version: Code 1.92.2 (fee1edb8d6d72a0ddff41e5f71a671c23ed924b9, 2024-08-14T17:29:30.058Z)
OS version: Windows_NT x64 10.0.22631
Modes:

System Info
Item Value
CPUs AMD Ryzen 5 3500U with Radeon Vega Mobile Gfx (8 x 2096)
GPU Status 2d_canvas: enabled
canvas_oop_rasterization: enabled_on
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: disabled_off
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled
webnn: disabled_off
Load (avg) undefined
Memory (System) 9.94GB (3.36GB free)
Process Argv --crash-reporter-id 587481dc-7481-4237-b6c2-fc757d6b10f8
Screen Reader no
VM 0%

This issue did not exist in the previous version.

What version are you referring to here?

This issue did not exist in the previous version.

What version are you referring to here?

2.12.1.

@rgarciale What is your QCCSID and typical job CCSID or user profile CCSID?

cc @sebjulliand possibly related to #2215. Going to try and write a test case when I get more info.

@rgarciale What is your QCCSID and typical job CCSID or user profile CCSID?

User CCSID is 65535 (*sysval)
SourceFile CCSID is 284

@rgarciale What is the QCCSID?

@rgarciale What is the QCCSID?

65535

Are you able to go back to 2.12.1, and open the member successfully? Please share the contents of your Code for IBM i output channel after the member opens. Then, please do the same with 2.13.0. Thanks!

image

Are you able to go back to 2.12.1, and open the member successfully? Please share the contents of your Code for IBM i output channel after the member opens. Then, please do the same with 2.13.0. Thanks!

v2.12.1
v2.12.1.txt
v2 12 1

v2.13.0
v2.13.0.txt
v2 13 0

In Code for IBM i 2.12.1, I cannot create a source file with Ñ.

/home/LIAMA: /QOpenSys/usr/bin/qsh
system  "CRTSRCPF FILE(LIAMA/ÑHELLO) RCDLEN(112)"
{
    "code": 1,
    "signal": null,
    "stdout": "",
    "stderr": "CPD0012:  Characters in qualifier beginning 'ÑHELLO) RC' not valid.\nCPF0001:  Error found on *N command."
}

Are you able to do this @rgarciale?

In Code for IBM i 2.12.1, I cannot create a source file with Ñ.

/home/LIAMA: /QOpenSys/usr/bin/qsh
system  "CRTSRCPF FILE(LIAMA/ÑHELLO) RCDLEN(112)"
{
    "code": 1,
    "signal": null,
    "stdout": "",
    "stderr": "CPD0012:  Characters in qualifier beginning 'ÑHELLO) RC' not valid.\nCPF0001:  Error found on *N command."
}

Are you able to do this @rgarciale?

yes I do.

/home/BCOINFRGL: /QOpenSys/usr/bin/qsh
system "CRTSRCPF FILE(LIBDREAMT/ÑPRUEBA) RCDLEN(112)"
{
"code": 0,
"signal": null,
"stdout": "",
"stderr": "CPC7301: Archivo ÑPRUEBA creado en la biblioteca LIBDREAMT.\nCPC2206: Se ha modificado la propiedad del objeto QZSHSYSTEM en QTEMP del tipo *USRSPC."
}

@rgarciale After connecting to the system, are you able to click on the Report an Issue item and then share the contents that appear in this issue? That might help me track down some more information I need.

image

@rgarciale After connecting to the system, are you able to click on the Report an Issue item and then share the contents that appear in this issue? That might help me track down some more information I need.

image

I cannot perform that action because company policies prevent me from generating the report.

Sorry for the inconvenience. :-(

@rgarciale Have you tried changing your userprofile to have CCSID 284 instead of 65535? Does that make a difference?

65535 means no conversion at all - and you need conversion of the character Ñ, which is a variant of the character # in CCSID 37 (US).

Btw, what is the reason for creating a member with a variant character in the name? These variant characters are causing a lot of problems for IBM i programmers - and it is recommended to avoid using these characters in object names, member name, variable names etc. They were typically used to indicate a special type of variable, member, object, but they are not that useful anymore in the modern world with long RPG variable names, long SQL identifiers etc.

@rgarciale Have you tried changing your userprofile to have CCSID 284 instead of 65535? Does that make a difference?

65535 means no conversion at all - and you need conversion of the character Ñ, which is a variant of the character # in CCSID 37 (US).

Btw, what is the reason for creating a member with a variant character in the name? These variant characters are causing a lot of problems for IBM i programmers - and it is recommended to avoid using these characters in object names, member name, variable names etc. They were typically used to indicate a special type of variable, member, object, but they are not that useful anymore in the modern world with long RPG variable names, long SQL identifiers etc.

I will request a change of the CCSID for my user profile to run the test, as I don't have permission to modify the profile myself.

Regarding the creation of source files with the character Ñ, it happens because the PDE tool we use for source control creates them this way. :-/

Best regards, and thank you for your help! :-)

Hi @chrjorgensen,

I tried this advice that you provide

@rgarciale Have you tried changing your userprofile to have CCSID 284 instead of 65535? Does that make a difference?

DSPUSRPRF USRPRF(MY USER)

The detail:

ID de juego de caracteres . . . . .: 284

But this not make any difference for me, the problem it's still happening.

Any other idea? :(

@e1mais Did you Connect and Reload Server Settings? The changed user setting is only picked up when doing this...

@chrjorgensen Yes I did.

My steps:

F1 > dev:Reload window > code4i: Connect and Reload Server settings.

I also notice other thing on the tooltip when I hover the Source File name, those are named without Ñ character expand with all the information (Text, Members, Length, and the CCSID with the corresponding 284) but for those Ñ-named Source files the information is: Members: 0, Length works well, and for CCSID is ?

I attached you the tooltip info for better understanding

IMG_20240830_131509.jpg

Right, same problem hete.

Hello @worksofliam, I was able to replicate the error on PUB400. These are the steps I followed to do so:

IBM i:
CHGPRF LANGID(ESP) CNTRYID(ES) CCSID(284)

image

CRTPF FILE(BCOINFRGL1/ÑTEST) RCDLEN(112) FILETYPE(*SRC) MAXMBRS(*NOMAX)
image

ADDPFM FILE(BCOINFRGL1/ÑTEST) MBR(PGM1) SRCTYPE(RPGLE)
image

WRKMBRPDM FILE(BCOINFRGL1/ÑTEST)
image

VS Code:
image

log.txt

Hello, @worksofliam

It seems that the issue is with the cast char for bit data in the IBMContent.ts/getMemberList.
I removed the for bit data, and now the members are showing up.

image

image

However, the problem now is that the authority of the objects isn't changing, and they cannot be edited. I will continue investigating.

image

@rgarciale I'd like to check something. Could you connect to your LPAR and click on Report an issue?
image

It will open a new issue template in your browser. Copy and paste the template here, I'd like to see some details about your LPAR. Thanks!

@sebjulliand. Sure,

👉🏻 Issue text goes here.


⚠️ REMOVE THIS LINE AND ANY SENSITIVE INFORMATION BELOW! ⚠️

Context Version
Code for IBM i version 2.13.0
Visual Studio Code version 1.93.0
Operating System win32_x64
Active extensions
COBOL (cobol): 10.8.31
Code for IBM i Walkthroughs (vscode-ibmi-walkthroughs): 0.5.0
Configuration Editing (configuration-editing): 1.0.0
Db2 for IBM i (vscode-db2i): 1.3.1
ESLint (vscode-eslint): 3.0.10
Emmet (emmet): 1.0.0
Error Lens (errorlens): 3.20.0
Extension Authoring (extension-editing): 1.0.0
Git (git): 1.0.0
Git Base (git-base): 1.0.0
GitHub (github): 0.0.1
GitHub Authentication (github-authentication): 0.0.2
IBM i Debug (ibmidebug): 2.0.1
JSON Language Features (json-language-features): 1.0.0
Merge Conflict (merge-conflict): 1.0.0
NPM support for VS Code (npm): 1.0.1
Node Debug Auto-attach (debug-auto-launch): 1.0.0
TODO Highlight (vscode-todo-highlight): 1.0.5
TypeScript and JavaScript Language Features (typescript-language-features): 1.0.0

Remote system
Setting Value
IBM i OS V7R5M0
Tech Refresh n/a
CCSID Origin 273
Runtime CCSID 273
Default CCSID 273
SQL Enabled
Source dates Disabled

Enabled features

/QOpenSys/pkgs/bin /usr/bin /QSYS.LIB /QIBM/ProdData/IBMiDebugService/bin
bash attr QZDFMDB2.PGM startDebugService.sh
chsh iconv
find setccsid
git
grep
ls
md5sum
sort
stat
tar
tn5250
Shell env
BUILDLIB=BCOINFRGL1
CURLIB=BCOINFRGL1
HOME=/home/BCOINFRGL
HOST=PUB400.COM
LIBLS=GAMES400 QTEMP QGPL
LOGIN=bcoinfrgl
LOGNAME=bcoinfrgl
MAIL=/var/spool/mail/bcoinfrgl
OLDPWD=/home/BCOINFRGL
PASE_USRGRP_LIMITED=N
PATH=/QOpenSys/pkgs/bin:/QOpenSys/usr/bin:/usr/ccs/bin:/QOpenSys/usr/bin/X11:/usr/sbin:.:/usr/bin:/QOpenSys/usr/bin:/usr/bin
PWD=/home/BCOINFRGL
SHELL=/QOpenSys/pkgs/bin/bash
SHLVL=1
SSH_CLIENT=186.26.118.186 35999 2222
SSH_CONNECTION=186.26.118.186 35999 185.113.5.134 2222
TZ=<UTC>0
USER=bcoinfrgl
USERNAME=BCOINFRGL
WORKDIR=/home/BCOINFRGL
_=/QOpenSys/pkgs/bin/env
Variants
{
  "american": "#@$",
  "local": "#§$"
}
Errors
[
  {
    "command": "/QOpenSys/usr/bin/qsh",
    "code": 1,
    "stderr": "CPD0012:  Characters in qualifier beginning 'ÑRPGLESRC)' not valid.\nCPF0001:  Error found on *N command.",
    "cwd": "/home/BCOINFRGL"
  },
  {
    "command": "cd \"/QSYS.LIB/BCOINFRGL1.LIB/ÑRPGLESRC.FILE\" && (ls | wc -l)",
    "code": 1,
    "stderr": "bash: line 1: cd: $'/QSYS.LIB/BCOINFRGL1.LIB/\\303\\221RPGLESRC.FILE': No such file or directory",
    "cwd": "/home/BCOINFRGL"
  },
  {
    "command": "/QOpenSys/usr/bin/qsh",
    "code": 1,
    "stderr": "CPD0012:  Characters in qualifier beginning 'ÑTEST) OBJ' not valid.\nCPF0001:  Error found on *N command.",
    "cwd": "/home/BCOINFRGL"
  }
]

@sebjulliand

I have been doing some testing and have found the following:

When commands are executed directly from qsh, the objects are displayed with the # character.
For example:
image

However, when the command is executed from DB2, the objects are listed with the Ñ character. It seems this is causing some issues.

image
image

There is an issue with the variant characters here. I assume that the issue template you sent was taken from PUB400, and not the LPAR your issue originated from.

image

As you can see, the LPAR CCSID is 273, and Ñ is not handled there because it's not a valid object name character with this CCSID.
Ñ is CCSID 284 variant of # and that's why it can be used when the job CCSID is 284.

I tried your use case above on PUB400, and it failed, as expected. But more importantly, I noticed the variant characters were still CCSID 273's, and not 284's, even after changing my profile's CCSID and reloading the settings.
image

All I can assume for now is:

  • variant characters are messing with some of our queries
  • if system variable QCCSID is set to something else than 65535, then variant characters are not loaded for the user's CCSID but for QCCSID's value

My guess here is that if:

  • the LPAR QCCSID is set to 284
  • OR if it is set to 65535 and your user profile's CCSID is 284

Then having Ñ in object names should be OK.
Otherwise, welcome to CCSID's hell 😁

Hello @sebjulliand

I managed to get it working. I made the following change, and now I can see the sources and modify them. Obviously, it's not a real fix, but maybe this’ll help fix the issue.

image

image

image

image

And yeah, CCSID is a total pain ;-D

Hello, @worksofliam @sebjulliand @chrjorgensen

I finally found the error.

The problem is not exclusive to the "Ñ" character. It happens when there is a character conversion due to the LPAR configuration between variantChars.american and variantChars.locale

For example, in PUB400, the "@" character has a conversion:

Variants
{
  "american": "#@$",
  "local": "#§$"
}

The issue arises when listing the objects using the getObjectList function, as they are listed in local format.

However, when retrieving members using getMemberList, the object filter is passed through the sysNameInAmerican function, which causes the members not to be listed correctly.

"I created a source that starts with @ in my library."

image

When I view it in VS Code, it appears in the LPAR format.

image

But when trying to retrieve the members, they are processed using the variantChars.american format

image

And it doesn't display anything.

image

To fix the issue, I modified the functions getObjectList and getMemberList so that when listing the members, it does not convert them in american format.

getObjectList
image
image

getMemberList
image

And now it works as it should.

image

Can this solution be implemented to fix the problem with character conversion?

@rgarciale if the CCSID variant characters are not swapped with their CCSID 37 equivalent, it's going to crash for anyone having the variants rights (see #2239 (comment) above).

These variants are NOT those for CCSID 284; they are 273's:
image

284 variants are: Ñ@$.

It seems that since PUB400 system CCSID is set 273, changing your profile's CCSID to 284 will not let you work with the corresponding variants. The routine used to load the variants in Code for IBM i get those from the system CCSID if it's not 65635. The query used returns it like that and it doesn't seem we can do something about it.

Back on your original system (not PUB400), if the system CCSID is 65535 and your user profile's CCSID is 284, there is a good chance that browsing libraries/files/members with Ñ it should work.

Hi @sebjulliand

I tried changing my user profile's CCSID to 284, as you suggested, but it still doesn't work.

image

image

I got the information from LPAR 65535.


Context Version
Code for IBM i version 2.13.0
Visual Studio Code version 1.92.2
Operating System win32_x64
Active extensions
COBOL (cobol): 10.8.31
Code for IBM i Walkthroughs (vscode-ibmi-walkthroughs): 0.5.0
Configuration Editing (configuration-editing): 1.0.0
Emmet (emmet): 1.0.0
Error Lens (errorlens): 3.20.0
Git (git): 1.0.0
Git Base (git-base): 1.0.0
GitHub (github): 0.0.1
IBM i Debug (ibmidebug): 2.0.1
JSON Language Features (json-language-features): 1.0.0
Merge Conflict (merge-conflict): 1.0.0
Node Debug Auto-attach (debug-auto-launch): 1.0.0
Print (vscode-print): 0.13.1
TODO Highlight (vscode-todo-highlight): 1.0.5
Text Marker (Highlighter) (text-marker): 1.11.0
TypeScript and JavaScript Language Features (typescript-language-features): 1.0.0

Remote system
Setting Value
IBM i OS V7R5M0
Tech Refresh 4
CCSID Origin 65535
Runtime CCSID 65535
Default CCSID 284
SQL Enabled
Source dates Enabled

Enabled features

/QOpenSys/pkgs/bin /usr/bin /QSYS.lib/ILEDITOR.lib /QSYS.LIB /QIBM/ProdData/IBMiDebugService/bin
bash attr GETNEWLIBL.PGM QZDFMDB2.PGM startDebugService.sh
find iconv
git setccsid
grep
ls
md5sum
sort
stat
tar
tn5250
Shell env
BUILDLIB=LIBRGL
CURLIB=LIBRGL
HOME=/home/XXX
HOST=XXX
LOGIN=xxx
LOGNAME=xxx
MAIL=/var/spool/mail/xxx
OLDPWD=/home/xxx
PASE_USRGRP_LIMITED=N
PATH=/QOpenSys/pkgs/bin:/QOpenSys/usr/bin:/usr/ccs/bin:/QOpenSys/usr/bin/X11:/usr/sbin:.:/usr/bin:/QOpenSys/usr/bin:/usr/bin
PWD=/home/xxx
SHELL=/QOpenSys/pkgs/bin/bash
SHLVL=1
SSH_CLIENT=00.00.00.00 62560 22
SSH_CONNECTION=00.00.00.00 62560 00.00.00.00 22
TZ=<UTC-06x00S>6
USER=xxx
USERNAME=xxx
WORKDIR=/home/xxx
_=/QOpenSys/pkgs/bin/env
Variants
{
  "american": "#@$",
  "local": "Ñ@$"
}
Errors
[
  {
    "command": "/QOpenSys/usr/bin/qsh",
    "code": 1,
    "stderr": "CPD0032:  No tiene autorización para el mandato CRTLIB en la biblioteca *LIBL.\nCPF0001:  Se ha encontrado un error en el mandato CRTLIB.\nCPC2206:  Se ha modificado la propiedad del objeto QZSHSYSTEM en QTEMP del tipo *USRSPC.",
    "cwd": "/home/BCOINFR"
  },
  {
    "command": "/QOpenSys/usr/bin/qsh",
    "code": 1,
    "stderr": "CPF9801:  No se ha encontrado el objeto QCPTOIMPF en la biblioteca QSYS.\nCPC2206:  Se ha modificado la propiedad del objeto QZSHSYSTEM en QTEMP del tipo *USRSPC.",
    "cwd": "/home/BCOINFR"
  },
  {
    "command": "/QOpenSys/usr/bin/qsh",
    "code": 1,
    "stderr": "CPF9801:  No se ha encontrado el objeto QCPFRMIMPF en la biblioteca QSYS.\nCPC2206:  Se ha modificado la propiedad del objeto QZSHSYSTEM en QTEMP del tipo *USRSPC.",
    "cwd": "/home/BCOINFR"
  }
]

Thanks for your time and suggestion, and sorry for being so persistent. It's just that some people in my workplace are using VS Code for IBM i, and I really love it, but we need it to work properly with the "Ñ". Otherwise, we'll have to stop using it. For now, we're stuck on version 2.12.1.

Indeed, we have the same problem. Hope you can fix this to keep using code for i.