Search code examples
visual-studio-coderpgleibm-ifs

Why won't the compile actually include my /COPY rpgleinc source?


I am a long-time RPG developer on IBM i, now migrating my development to Visual Studio Code locally with git using the Code for IBM i (v2.14.5) and IBM i Development Pack (v0.2.0) extensions. My ultimate goal is to get bob (Better Object Builder) implemented. So I'm currently in the process of aligning my source to comply with recommended project structure (myprogram.pgm.sqlrpgle, myincludes.rpgleinc, etc.).

Most of this has gone well. Now, I'm running into a rather odd scenario where it seems the left-hand doesn't know what right-hand is doing.

I have an sqlrpgle source, lets call it 'myprogram.pgm.sqlrpgle' located in the qrpglesrc folder in my project. It references 'qcopysrc/myincludes.rpgleinc' with /copy.

Hovering over the path, it pops up: /c:/rootpath/projectname/repofolder/qcopysrc/myincludes.rpgleinc (found) Further down in the myprogram code where it references code from myincludes, hovering over a variable that is defined within myincludes by /copy it pops up: `incVariable char(10) (3 references)

@file file:///c%3A/rootpath/projectname/repofolder/qcopysrc/myincludes.rpgleinc:24 `

At this point everything looks great.

Then I choose Run Action --> Create SQLRPGLE Program I choose Compare (Synchronizes using MD5 hash comparison) It begins deploying the tarball and performs the compile.

The compile fails due to variables that are declared in the include file not being defined. In the compile listing it "attempted" to bring in the /copy include file, but didn't actually include its contents.

 49  /Copy 'qcopysrc/myincludes.rpgleinc'                                                                                000049
     *--------------------------------------------------------------------------------------------*
     * RPG member name  . . . . . :  myinclude+                                                   *                     1
     * External name  . . . . . . :  ./qcopysrc/myincludes.rpgleinc                               *                     1
     * Last change  . . . . . . . :  02/03/25  19:38:11                                           *                     1

I don't know what I'm missing as far as configuration setup. What am I missing?

I'm expecting to have a clean compile with the /copy file included into the program so that it has the variable definitions present as referenced later in the program source.


Solution

  • I finally discovered the issue, and along the way encountered two other very bizarre similar issues in trying to compile other SQLRPGLE and RPGLE sources.

    All three problems had the same root cause and manifested their errors differently. This one simply would not bring in the /COPY source. A different SQLRPGLE source generated CPF9549 "Error addressing API parameter" while compiling. The RPGLE source generated RNS9311 "Compilation stopped. Internal failure occurred. Error code is 1."

    As I continued to troubleshoot all this, I discovered that these issues had nothing to do with VS Code or its Extensions in any way. I was able to replicate all issues at a 5250 emulator command line on the IBM i.

    As I mentioned previously, I am in the middle of migrating my RPG development to VS Code and git. At this point in time there has been very little code clean-up performed after copying the native source file members to files in the IFS and naming them appropriately just prior to adding them all to git commitment control and pushing them up to the Azure repo.

    What I discovered was that many of the sources contained special characters in comment lines that when viewed in SEU would colorize that source. Compiling the source from a native source file worked without any problems, but when attempting to compile from an IFS source file, the compiler would choke on the comment lines containing these special characters and present the failure in a variety of ways. My /COPY source file contained these special characters and the compiler simply would not include the file. After removing the special characters, it compiled flawlessly. Likewise the sources that failed with CPF9549 and RNS9311 also compiled normally after removing the special characters from the comment lines.