Update SQL query in downloadMemberContentWithDates to handle specific…#2736
Conversation
|
@chrjorgensen I'd love your thoughts here. You helped with something akin to this when we previously supported SEU colors. |
chrjorgensen
left a comment
There was a problem hiding this comment.
@e1mais Thank you for your PR - good catch of what seems to be an error with the RTVBNDSRC command, not writing correct numeric dates in the source retrieved. 👍
Your change works perfectly, and I have only one request: Please add yourself to the CONTRIBUTING.md file. 🙏
Once done, we can merge your change into the master branch.
|
@chrjorgensen Done, I have now added myself to the list of contributors, thank you very much for the review |
chrjorgensen
left a comment
There was a problem hiding this comment.
@e1mais Thank you - your change have now been tested once more and works fine.
I'll approve and merge this PR.
Btw, the RTVBNDSRC command has more than one flaw: If you don't create the source file beforehand, RTVBNDSRC will create the file for you - with CCSID 65535 for SRCDTA, which can't be opened in C4i...!
Not a great job by IBM here.... 😞

Changes
Hello everyone,
This Pull Request addresses an issue that occurs when trying to open source members generated by the RTVBNDSRC (Retrieve Binder Source) command using the Code for IBM i extension.
The purpose of RTVBNDSRC is to retrieve the export symbols EXPORT SYMBOL("PROCNAME") from an object of type MODULE or SRVPGM, and write them into a source member. This source is then used as input for the CRTSRVPGM command, allowing the signature of the SRVPGM to be preserved when it is regenerated.
Problem
The source member generated by RTVBNDSRC does not contain a valid date in the SRCDAT field. As a result, when the extension tries to open the member using the ALIAS object, it fails, as shown in the image below:
The extension accesses the content of source members using this ALIAS object. However, if the SRCDAT field contains blank spaces (which is invalid for a NUMERIC(6,0) field), an SQL error occurs when attempting to read the data:
SQL0802 – Data conversion or data mapping error
SQLSTATE 01004 – Truncation warning
Error type: 6
Solution
To avoid these conversion or mapping errors when opening members with invalid SRCDAT values, I have modified the query used by the extension. It now returns 0 as the value for SRCDAT when blank spaces are detected, and the original value when it's valid, thus preventing the aforementioned failures.
I appreciate any feedback or suggestions you may have regarding this solution.
Steps to reproduce the issue:
Create or use an existing module.
Create a BND-type member in your own source file:
ADDPFM FILE(*CURLIB/QSRCBND) MBR(BNDSRC1) TEXT('Example BND source member') SRCTYPE(BND)Use the RTVBNDSRC command to retrieve the export symbols into the created member:
Open the member using Code for IBM i and observe the error.
How to test this PR
Checklist
console.logs I added