vscode-rpgle
vscode-rpgle copied to clipboard
RPGLE Lint error on DS sub field defined in Workstation/Keyed file
Is it possible to remove the not reference lint error for fields defined in DSPF or PF and used on a DCL-F statement? These fields are defined in a DS to then overlaid by an array. While technically true these fields are not used in the RPGLE source to define these DS's to use overlay is cumbersome.
I will work on a test sample if this can be done and if desired.
It's likely possible, yes. If you've got a sample, that'd make my life just that bit easier.
After some thought about this, I could make this change, but the better thing I should likely do is make this rule more granular.
This is because the linter needs to work offline and when offline we don't have access to external file information.
Liam
Okay. You may prioritize as a low to medium need.
I think the right answer here is that if the POS
keyword is found and the parent DS has references, then it should not be marked as unused.
This would make a lot of source I have to deal with look better.
Your solution looks like it will work for the example I gave above but looking over the DS for CRTFRMSTMF tool there are null named sub-fields that are marked up. It seems like *n
field definitions should be ignored.
**FREE
...
// Valid commands and the corresponding object type
DCL-DS CommandsDS;
*n CHAR(10) INZ('CRTCMD');
*n CHAR(10) INZ('CRTBNDCL');
*n CHAR(10) INZ('CRTCLMOD');
*n CHAR(10) INZ('CRTDSPF');
*n CHAR(10) INZ('CRTPRTF');
*n CHAR(10) INZ('CRTLF');
*n CHAR(10) INZ('CRTPF');
*n CHAR(10) INZ('CRTMNU');
*n CHAR(10) INZ('CRTPNLGRP');
*n CHAR(10) INZ('CRTQMQRY');
*n CHAR(10) INZ('CRTSRVPGM');
*n CHAR(10) INZ('CRTWSCST');
*n CHAR(10) INZ('CRTRPGPGM');
*n CHAR(10) INZ('CRTSQLRPG');
Commands CHAR(10) DIM(14) POS(1);
END-DS;
DCL-DS ObjTypesDS;
*n CHAR(10) INZ('CMD');
*n CHAR(10) INZ('PGM');
*n CHAR(10) INZ('MODULE');
*n CHAR(10) INZ('FILE');
*n CHAR(10) INZ('FILE');
*n CHAR(10) INZ('FILE');
*n CHAR(10) INZ('FILE');
*n CHAR(10) INZ('MENU');
*n CHAR(10) INZ('PNLGRP');
*n CHAR(10) INZ('QMQRY');
*n CHAR(10) INZ('SRVPGM');
*n CHAR(10) INZ('WSCST');
*n CHAR(10) INZ('PGM');
*n CHAR(10) INZ('PGM');
ObjTypes CHAR(10) DIM(14) POS(1);
END-DS;