Skip to content

Conversation

@worksofliam
Copy link
Member

@worksofliam worksofliam commented Oct 26, 2025

Changes

Rips out the legacy SQL runner with Mapepire, which is bundled in the VSIX and installed as a component.

ILE command improvements

runCommand has a lot of new logic. We now we should do all compiles with SQL. This means no more system, no more standard in or standard out from system. Due to that, we no longer have access to the job log or spool file generated by the executed command.

runCommand has four steps now:

  1. Set the library list (using qcmdexc - if required)
  2. Execute the command (using qcmdexc)
  3. Fetch the latest job log entries job log (using qsys2.joblog_info('*'))
    • I am not sure if this logic is sound proof, since we are depending on ORDINAL_POSITION and I believe there are some instances where it is not updated correctly from prior commands. The only way to get around that is to always fetch the job log even if it's not needed (skipDetail)
  4. Fetch the spool file (using a complicated statement)

Due to this implementation, runCommand cannot really run asynchronously like system allowed. At the runCommand level, I have had to implement a queue system so that these sequence of events can only happen one at a time. This ensures the right job log and spool file is returned for the correct command.

To do

  • Update build to run npm run dsc as part of VSIX build
  • Ensure all test cases are passing under Mapepire
  • Test different CCSID scenarios
  • Remove/replace all liblist usage
  • Ensure that the component is valid with the existing install from the database extension

How to test this PR

  • Ensure the test cases pass

Checklist

  • have tested my change
  • have created one or more test cases
  • updated relevant documentation
  • Remove any/all console.logs I added
  • have added myself to the contributors' list in CONTRIBUTING.md

Signed-off-by: worksofliam <[email protected]>
Signed-off-by: worksofliam <[email protected]>
Signed-off-by: worksofliam <[email protected]>
Signed-off-by: worksofliam <[email protected]>
Signed-off-by: worksofliam <[email protected]>
Signed-off-by: worksofliam <[email protected]>
Signed-off-by: worksofliam <[email protected]>
Signed-off-by: worksofliam <[email protected]>
@worksofliam worksofliam changed the title Feature/mapepire_internals Mapepire as SQL runner Oct 26, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Oct 26, 2025

👋 A new build is available for this PR based on f07c9bc.

Signed-off-by: worksofliam <[email protected]>
Signed-off-by: worksofliam <[email protected]>
Signed-off-by: worksofliam <[email protected]>
Signed-off-by: worksofliam <[email protected]>
worksofliam and others added 22 commits December 1, 2025 22:19
Signed-off-by: worksofliam <[email protected]>
Signed-off-by: worksofliam <[email protected]>
Signed-off-by: worksofliam <[email protected]>
Signed-off-by: worksofliam <[email protected]>
Signed-off-by: worksofliam <[email protected]>
Signed-off-by: worksofliam <[email protected]>
Signed-off-by: worksofliam <[email protected]>
Signed-off-by: worksofliam <[email protected]>
Signed-off-by: worksofliam <[email protected]>
@julesyan julesyan temporarily deployed to testing_environment December 4, 2025 20:09 — with GitHub Actions Inactive
@julesyan
Copy link
Member

julesyan commented Dec 4, 2025

All test cases now pass

@julesyan julesyan marked this pull request as ready for review December 12, 2025 12:14
@chrjorgensen chrjorgensen added this to the 3.0.0 milestone Dec 12, 2025
Copy link
Collaborator

@chrjorgensen chrjorgensen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@worksofliam Before this PR we could get more than one spoolfile from one command in an action. One example is found in issue #3004.

Will this PR support that?

We don't know how many spoolfiles are created by one command run, and we may need them all. User created build commands may run more than one CRT-command and thus create more than one spoolfile.

}
}

const LAST_SPOOL_STATEMENT = [
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@worksofliam This SQL statement will get the latest spoolfile created by the user - but not necessarily created in this job! If the user has other jobs running, also creating spoolfiles, this SQL may pick one of those instead of the intended one...

@worksofliam
Copy link
Member Author

@chrjorgensen it is likely we'll need to track previously obtains spools like we do job log messages. It's not something we do in this at the moment, but we can likely do it. It currently just fetches the latest spoil after the command has executed.

Copy link
Member Author

@worksofliam worksofliam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this a big issue?

await this.ibmi.runSQL([
`@QSYS/CPYF FROMFILE(${library}/${sourceFile}) FROMMBR(${member}) TOFILE(QTEMP/QTEMPSRC) TOMBR(TEMPMEMBER) MBROPT(*REPLACE) CRTFILE(*YES);`,
`@QSYS/CPYFRMSTMF FROMSTMF('${tempRmt}') TOMBR('${Tools.qualifyPath("QTEMP", "QTEMPSRC", "TEMPMEMBER", undefined)}') MBROPT(*REPLACE) STMFCCSID(1208) DBFCCSID(${this.config.sourceFileCCSID})`,
`@QSYS/CPYFRMSTMF FROMSTMF('${tempRmt}') TOMBR('${Tools.qualifyPath("QTEMP", "QTEMPSRC", "TEMPMEMBER", undefined)}') MBROPT(*REPLACE)`,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why was streamfile CCSID removed?

}
else {
copyResult = await this.ibmi.runCommand({
command: `QSYS/CPYFRMSTMF FROMSTMF('${tempRmt}') TOMBR('${path}') MBROPT(*REPLACE) STMFCCSID(1208) DBFCCSID(${this.config.sourceFileCCSID})`,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here, why was streamfile CCSID removed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants