Closed fathert closed 2 years ago
I have no idea where you're getting RPGPPOPT
from.
/home/alan3/eog_demo/: system "QSYS/CPYTOIMPF FROMFILE(CMPSYS/EVFEVENT DEPTS_WEB) TOSTMF('/tmp/vscodetemp-O_h3KCyUdl') MBROPT(*REPLACE) STMFCCSID(1208) RCDDLM(*CRLF) DTAFMT(*DLM) RMVBLANK(*TRAILING) ADDCOLNAM(*SQL) FLDDLM(',') DECPNT(*PERIOD) "
{
"code": 0,
"signal": null,
"stdout": "CPC2958: All records copied from file EVFEVENT in CMPSYS.",
"stderr": ""
}
We don't even have any record of it in the codebase.
But I can also see the name of the member is missing on your CPYTOIMPF
command.
Can you share the compile command that you're running and the result? (it's usually above that CPYTOIMPF
in that same output)
Hi Liam,
I debugged the code and found the issue. There's a problem when compiling SQLRPGLE types of *MODULE because the function below scans the command...
CRTSQLRPGI OBJ(LSP_03G9/SNDXMLTOQ) SRCFILE(LSP_03G9/QRPGLESRC) CLOSQLCSR(*ENDMOD) OPTION(*EVENTF) DBGVIEW(*SOURCE) TGTRLS(*CURRENT) OBJTYPE(*MODULE) RPGPPOPT(*LVL2)
...and finds the string "*MODULE" in the command and assumes it's the position of the MODULE parameter, when in fact it's not.
/**
*
* @param {string} baseCommand
* @returns {{lib?: string, object: string}}
*/
static getObjectFromCommand(baseCommand) {
const possibleParms = [`MODULE`, `PNLGRP`, `OBJ`, `PGM`];
const command = baseCommand.toUpperCase();
for (const parm of possibleParms) {
const idx = command.indexOf(parm);
if (idx >= 0) {
const firstBracket = command.indexOf(`(`, idx);
const lastBracket = command.indexOf(`)`, idx);
if (firstBracket >= 0 && lastBracket >= 0) {
const value = command
.substring(firstBracket+1, lastBracket)
.split(`/`)
.map(v => v.trim());
if (value.length === 2) {
return {
lib: value[0],
object: value[1],
};
} else {
return {
object: value[0],
};
}
}
break;
}
}
return null;
}
I can also break it by trying to compile a member with the word "OBJ" in the name. So doing a CRTPGM against QRPGLESRC/SAVEOBJ also fails.
I have experimented with using a regular expression instead of a string scanner, which seems to work. Here's the code:
static getObjectFromCommand(baseCommand) {
const command = baseCommand.toUpperCase();
const parmRegex = /(PNLGRP|OBJ|PGM|MODULE)\((?<object>.+?)\)/g;
const object = parmRegex.exec(baseCommand).groups.object.split('/');
if (object.length === 2) {
return {
lib: object[0],
object: object[1],
};
} else {
return {
object: object[0],
};
}
}
If the fix is of interest then I could try to create a pull request for you.
Cheers,
Tim.
@fathert Nice find and a great change. Please do make a PR.
Thanks, it's my first, so glad it was ok. Happy to contribute, I use the editor full time now - thanks for all your hard work!
@fathert that is so awesome to hear!! Thanks a bunch
@fathert may I ask you to reply to this thread if you haven't already?
Describe the bug After compilation the event file is not being copied back so no compilation feedback is displayed. There seems to be a rogue RPGPPOPT option in the CPYTOIMPF command.
To Reproduce Steps to reproduce the behavior:
/home/PGMR85: system "QSYS/CPYTOIMPF FROMFILE(LSP_03G9/EVFEVENT ) RPGPPOPT() TOSTMF('/tmp/vscodetemp-O_N4eShc1X') MBROPT(REPLACE) STMFCCSID(1208) RCDDLM(CRLF) DTAFMT(DLM) RMVBLANK(TRAILING) ADDCOLNAM(SQL) FLDDLM(',') DECPNT(PERIOD) " { "code": 255, "signal": null, "stdout": "", "stderr": "CPD0043: Schlüsselwort RPGPPOPT für diesen Befehl ungültig.\nCPF0006: Im Befehl ist ein Fehler aufgetreten." }