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

Support library list when using include directives

Open m-tyler opened this issue 3 years ago • 4 comments

Not absolutely a bug and isn't a feature ask but a need to make this extension more widely available.

Describe the issue I am seeing a lot of QSQSRVR logs generated during the day. Many, messages are errors related to using the ALIAS to get source data. Looking over the command to create the alias' it defaults to using the library specified in the connection parameters. I see a string like this in the OUTPUT, CREATE ALIAS ILEDITOR.DEVLIB_QCPYSRC_UTL000RGPR for DEVLIB.QCPYSRC(\"UTL000RGPR\")". However, member UTL000RGPR is only in the production product source library (at this time.) The error that occurs is this ""stderr": "UTL000RGPR in *N type *MEM not found. SQLSTATE=42704 SQLCODE=-204""

To Reproduce Develop code where copybooks reside in additional libraries on the *LIBL. OPen member, look at the Code for IBM i OUTPUT or look for joblog SPLFs with the value of QSQSRVR in the USRDTA column.

Expected behavior I would expect the extension to look for the source member on the library list. I don't know of a good API or shell command to use so this SQL would work, SELECT TABLE_SCHEMA, TABLE_NAME, TABLE_PARTITION from QSYS2.SYSPARTITIONSTAT inner join QSYS2.LIBRARY_LIST_INFO on TABLE_SCHEMA = SCHEMA_NAME where TABLE_NAME = 'QCPYSRC' and TABLE_PARTITION = 'UTL000RGPR'. The downside is this query might not be backward compatible with older IBM i systems.

Environment (please complete the following information):

  • Extension version [e.g. 0.8.27]
  • IBM i OS version [e.g. 7.3]

** OUTPUT results /home/PGMT: DB2UTIL_JSON_CONTAINER=array /QOpenSys/pkgs/bin/db2util -o json "SELECT LENGTH(srcdta) as LENGTH FROM ILEDITOR.PGMT_QCPYSRC_KRN00RRGPR limit 1" { "code": 1, "signal": null, "stdout": "", "stderr": "UTL000RGPR in *N type *MEM not found. SQLSTATE=42704 SQLCODE=-204" }

m-tyler avatar Feb 02 '22 20:02 m-tyler

This sounds like it's coming from the RPGLE language tools extension. Do you have RPGLE language tools installed? That extension does search for copybooks when source is opened.

If that's the case, I'm going to transfer the issue over there. To test, uninstall that extension, reload and try to recreate the issue again.

If it is RPGLE language tools, this is a known thing. It even says about the issue in the readme for that project.

worksofliam avatar Feb 02 '22 23:02 worksofliam

Yep apologies that is what is going on.

m-tyler avatar Feb 02 '22 23:02 m-tyler

The best bet is to somehow utilise RTVMBRD with *LIBL

worksofliam avatar Feb 03 '22 01:02 worksofliam

So an idea I had is for the product to utilize the EVFEVENTS data to collect the actual copybook members used. Since you cannot use QTEMP to work with I was thinking that ILEDITOR library could be used to run a mock compile, just to collect the FILEID entries from the EVFEVENT.

What I think this accomplishes is the reduced need to try to see if a copybook is actually located in a library. I am seeing A LOT of server jobs activating because of this and A LOT of log entries with failure codes.

I noticed that collecting EVFEVENT information data is already coded for.

m-tyler avatar May 06 '22 17:05 m-tyler

Closing as dupe of #127, which has more comments.

worksofliam avatar Feb 02 '23 01:02 worksofliam