vscode-rpgle icon indicating copy to clipboard operation
vscode-rpgle copied to clipboard

RPGLE Lint error on DS sub field defined in Workstation/Keyed file

Open m-tyler opened this issue 2 years ago • 7 comments

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.

image

I will work on a test sample if this can be done and if desired.

m-tyler avatar Dec 14 '22 21:12 m-tyler

It's likely possible, yes. If you've got a sample, that'd make my life just that bit easier.

worksofliam avatar Dec 14 '22 21:12 worksofliam

ISSUE_185D.DSPF.txt ISSUE_185.RPGLE.txt

These two members compile for me.

m-tyler avatar Dec 14 '22 22:12 m-tyler

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

worksofliam avatar Dec 22 '22 15:12 worksofliam

Okay. You may prioritize as a low to medium need.

m-tyler avatar Dec 23 '22 00:12 m-tyler

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.

worksofliam avatar Apr 29 '23 15:04 worksofliam

This would make a lot of source I have to deal with look better.

m-tyler avatar May 01 '23 13:05 m-tyler

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.

image

**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;

m-tyler avatar May 05 '23 20:05 m-tyler