vscode-ibmi
vscode-ibmi copied to clipboard
Errors not correctly cross-referenced to source (`*LVL2`)
Issue When compiling an SQLRPGLE module with several levels of nested includes, error messages aren't correctly cross referenced to the source.

To Reproduce Steps to reproduce the behavior:
- Create an SQLRPGLE source module with at least two levels of /include files and a deliberate syntax error.
- Compile the module with the following command CRTSQLRPGI OBJ(&LIB/&OBJ) SRCFILE(&FILE/QRPGLESRC) CLOSQLCSR(*ENDMOD) OPTION(*EVENTF) DBGVIEW(*SOURCE) TGTRLS(*CURRENT) OBJTYPE(*MODULE) RPGPPOPT(*LVL2)
Expected behavior The red squiggle should appear underneath the syntax error and clicking on the error in the problem list should locate to the error line. However, the error squiggle appears at the end of the source file and this is where the cursor is repositioned when clicking the error in the problem log.
Screenshots

versus RDi

Environment
- Extension version 0.8.2
- IBM i OS version 7.2
Additional context vscode.sqlrpgle.txt vscodeinc2.sqlrpgle.txt vscodeinc.sqlrpgle.txt
I've created the issue. If you take off RPGPPOPT(*LVL2) then it works as expected.. but I am looking into this now.
EVFEVENT content. We can see here, that because *LVL2 is being used, it's creating a temporary member with all the include statements expanded. Then is compiling that temporary member, and therefore the errors appear as if they're from one file.
TIMESTAMP 0 20211119083209
PROCESSOR 0 999 1
FILEID 0 999 000000 021 QTEMP/QSQLPRE(VSCODE) 20211119083209 0
FILEID 0 001 000000 023 BARRY/QRPGLESRC(VSCODE) 20211119083103 0
FILEID 0 002 000008 026 BARRY/QRPGLESRC(VSCODEINC) 20211119082637 0
EXPANSION 0 000 000000 000000 999 000009 000009
EXPANSION 0 002 000003 000003 999 000000 000000
FILEID 0 003 000007 027 BARRY/QRPGLESRC(VSCODEINC2) 20211119082613 0
EXPANSION 0 000 000000 000000 999 000016 000016
EXPANSION 0 003 000003 000003 999 000000 000000
FILEEND 0 003 000012
FILEEND 0 002 000010
FILEEND 0 001 000025
FILEEND 0 999 000047
PROCESSOR 0 999 1
FILEID 0 999 000000 023 QTEMP/QSQLTEMP1(VSCODE) 20211119083209 0
FILEID 0 001 000000 021 QTEMP/QSQLPRE(VSCODE) 20211119083209 0
EXPANSION 0 001 000000 000000 999 000035 000099
EXPANSION 0 001 000041 000041 999 000106 000114
EXPANSION 0 001 000041 000041 999 000116 000123
FILEEND 0 001 000047
FILEEND 0 999 000129
PROCESSOR 0 000 1
FILEID 0 001 000000 024 BARRY/EVFTEMPF01(VSCODE) 20211119083209 1
ERROR 0 001 1 000109 000109 009 000109 017 RNF7031 I 00 050 The name or indicator SQL_00001 is not referenced.
ERROR 0 001 1 000110 000110 009 000110 017 RNF7031 I 00 050 The name or indicator SQL_00002 is not referenced.
ERROR 0 001 1 000112 000112 009 000112 017 RNF7031 I 00 050 The name or indicator SQL_00004 is not referenced.
ERROR 0 001 1 000023 000023 003 000023 008 RNF7031 I 00 047 The name or indicator FIE1D1 is not referenced.
ERROR 0 001 1 000024 000024 003 000024 008 RNF7031 I 00 047 The name or indicator FIE1D2 is not referenced.
ERROR 0 001 1 000025 000025 003 000025 008 RNF7031 I 00 047 The name or indicator FIE1D3 is not referenced.
ERROR 0 001 1 000026 000026 003 000026 008 RNF7031 I 00 047 The name or indicator FIE1D4 is not referenced.
ERROR 0 001 1 000022 000022 008 000022 013 RNF7031 I 00 047 The name or indicator MYDS_T is not referenced.
ERROR 0 001 1 000099 000099 014 000099 019 RNF7031 I 00 047 The name or indicator SQFAPP is not referenced.
ERROR 0 001 1 000097 000097 014 000097 019 RNF7031 I 00 047 The name or indicator SQFCRT is not referenced.
ERROR 0 001 1 000098 000098 014 000098 019 RNF7031 I 00 047 The name or indicator SQFOVR is not referenced.
ERROR 0 001 1 000096 000096 014 000096 018 RNF7031 I 00 046 The name or indicator SQFRD is not referenced.
ERROR 0 001 1 000039 000039 011 000039 016 RNF7031 I 00 047 The name or indicator SQLAID is not referenced.
ERROR 0 001 1 000041 000041 011 000041 016 RNF7031 I 00 047 The name or indicator SQLABC is not referenced.
ERROR 0 001 1 000043 000043 011 000043 016 RNF7031 I 00 047 The name or indicator SQLCOD is not referenced.
ERROR 0 001 1 000045 000045 011 000045 016 RNF7031 I 00 047 The name or indicator SQLERL is not referenced.
ERROR 0 001 1 000047 000047 011 000047 016 RNF7031 I 00 047 The name or indicator SQLERM is not referenced.
ERROR 0 001 1 000049 000049 011 000049 016 RNF7031 I 00 047 The name or indicator SQLERP is not referenced.
ERROR 0 001 1 000051 000051 011 000051 016 RNF7031 I 00 047 The name or indicator SQLER1 is not referenced.
ERROR 0 001 1 000052 000052 011 000052 016 RNF7031 I 00 047 The name or indicator SQLER2 is not referenced.
ERROR 0 001 1 000053 000053 011 000053 016 RNF7031 I 00 047 The name or indicator SQLER3 is not referenced.
ERROR 0 001 1 000054 000054 011 000054 016 RNF7031 I 00 047 The name or indicator SQLER4 is not referenced.
ERROR 0 001 1 000055 000055 011 000055 016 RNF7031 I 00 047 The name or indicator SQLER5 is not referenced.
ERROR 0 001 1 000057 000057 011 000057 017 RNF7031 I 00 048 The name or indicator SQLERRD is not referenced.
ERROR 0 001 1 000059 000059 011 000059 016 RNF7031 I 00 047 The name or indicator SQLWN0 is not referenced.
ERROR 0 001 1 000060 000060 011 000060 016 RNF7031 I 00 047 The name or indicator SQLWN1 is not referenced.
ERROR 0 001 1 000061 000061 011 000061 016 RNF7031 I 00 047 The name or indicator SQLWN2 is not referenced.
ERROR 0 001 1 000062 000062 011 000062 016 RNF7031 I 00 047 The name or indicator SQLWN3 is not referenced.
ERROR 0 001 1 000063 000063 011 000063 016 RNF7031 I 00 047 The name or indicator SQLWN4 is not referenced.
ERROR 0 001 1 000064 000064 011 000064 016 RNF7031 I 00 047 The name or indicator SQLWN5 is not referenced.
ERROR 0 001 1 000065 000065 011 000065 016 RNF7031 I 00 047 The name or indicator SQLWN6 is not referenced.
ERROR 0 001 1 000066 000066 011 000066 016 RNF7031 I 00 047 The name or indicator SQLWN7 is not referenced.
ERROR 0 001 1 000067 000067 011 000067 016 RNF7031 I 00 047 The name or indicator SQLWN8 is not referenced.
ERROR 0 001 1 000068 000068 011 000068 016 RNF7031 I 00 047 The name or indicator SQLWN9 is not referenced.
ERROR 0 001 1 000069 000069 011 000069 016 RNF7031 I 00 047 The name or indicator SQLWNA is not referenced.
ERROR 0 001 1 000070 000070 011 000070 017 RNF7031 I 00 048 The name or indicator SQLWARN is not referenced.
ERROR 0 001 1 000072 000072 011 000072 016 RNF7031 I 00 047 The name or indicator SQLSTT is not referenced.
ERROR 0 001 1 000083 000083 015 000083 026 RNF7031 I 00 051 The name or indicator SQLCLSE... is not referenced.
ERROR 0 001 1 000087 000087 015 000087 026 RNF7031 I 00 051 The name or indicator SQLCMIT... is not referenced.
ERROR 0 001 1 000079 000079 015 000079 026 RNF7031 I 00 051 The name or indicator SQLOPEN... is not referenced.
ERROR 0 001 1 000125 000125 006 000125 009 RNF7030 S 30 042 The name or indicator TEST is not defined.
ERROR 0 001 1 000029 000029 008 000029 013 RNF7031 I 00 047 The name or indicator VSCODE is not referenced.
ERROR 0 001 1 000125 000125 006 000125 009 RNF7503 S 30 051 Expression contains an operand that is not defined.
ERROR 0 001 0 000000 000000 000 000000 000 RNS9308 T 50 057 Compilation stopped. Severity 30 errors found in program.
FILEEND 0 001 000129
Edit:
When *LVL2 is not used:
TIMESTAMP 0 20211119084745
PROCESSOR 0 999 1
FILEID 0 999 000000 023 QTEMP/QSQLTEMP1(VSCODE) 20211119084745 0
FILEID 0 001 000000 023 BARRY/QRPGLESRC(VSCODE) 20211119084536 0
EXPANSION 0 001 000000 000000 999 000013 000077
EXPANSION 0 001 000020 000020 999 000085 000093
EXPANSION 0 001 000020 000020 999 000095 000102
FILEEND 0 001 000027
FILEEND 0 999 000109
PROCESSOR 0 000 1
FILEID 0 001 000000 024 BARRY/EVFTEMPF01(VSCODE) 20211119084745 1
FILEID 0 002 000008 026 BARRY/QRPGLESRC(VSCODEINC) 20211119082637 0
FILEID 0 003 000007 027 BARRY/QRPGLESRC(VSCODEINC2) 20211119082613 0
FILEEND 0 003 000012
FILEEND 0 002 000010
ERROR 0 001 1 000088 000088 009 000088 017 RNF7031 I 00 050 The name or indicator SQL_00001 is not referenced.
ERROR 0 001 1 000089 000089 009 000089 017 RNF7031 I 00 050 The name or indicator SQL_00002 is not referenced.
ERROR 0 001 1 000091 000091 009 000091 017 RNF7031 I 00 050 The name or indicator SQL_00004 is not referenced.
ERROR 0 003 1 000008 000008 003 000008 008 RNF7031 I 00 047 The name or indicator FIE1D1 is not referenced.
ERROR 0 003 1 000009 000009 003 000009 008 RNF7031 I 00 047 The name or indicator FIE1D2 is not referenced.
ERROR 0 003 1 000010 000010 003 000010 008 RNF7031 I 00 047 The name or indicator FIE1D3 is not referenced.
ERROR 0 003 1 000011 000011 003 000011 008 RNF7031 I 00 047 The name or indicator FIE1D4 is not referenced.
ERROR 0 001 1 000077 000077 014 000077 019 RNF7031 I 00 047 The name or indicator SQFAPP is not referenced.
ERROR 0 001 1 000075 000075 014 000075 019 RNF7031 I 00 047 The name or indicator SQFCRT is not referenced.
ERROR 0 001 1 000076 000076 014 000076 019 RNF7031 I 00 047 The name or indicator SQFOVR is not referenced.
ERROR 0 001 1 000074 000074 014 000074 018 RNF7031 I 00 046 The name or indicator SQFRD is not referenced.
ERROR 0 001 1 000017 000017 011 000017 016 RNF7031 I 00 047 The name or indicator SQLAID is not referenced.
ERROR 0 001 1 000019 000019 011 000019 016 RNF7031 I 00 047 The name or indicator SQLABC is not referenced.
ERROR 0 001 1 000021 000021 011 000021 016 RNF7031 I 00 047 The name or indicator SQLCOD is not referenced.
ERROR 0 001 1 000023 000023 011 000023 016 RNF7031 I 00 047 The name or indicator SQLERL is not referenced.
ERROR 0 001 1 000025 000025 011 000025 016 RNF7031 I 00 047 The name or indicator SQLERM is not referenced.
ERROR 0 001 1 000027 000027 011 000027 016 RNF7031 I 00 047 The name or indicator SQLERP is not referenced.
ERROR 0 001 1 000029 000029 011 000029 016 RNF7031 I 00 047 The name or indicator SQLER1 is not referenced.
ERROR 0 001 1 000030 000030 011 000030 016 RNF7031 I 00 047 The name or indicator SQLER2 is not referenced.
ERROR 0 001 1 000031 000031 011 000031 016 RNF7031 I 00 047 The name or indicator SQLER3 is not referenced.
ERROR 0 001 1 000032 000032 011 000032 016 RNF7031 I 00 047 The name or indicator SQLER4 is not referenced.
ERROR 0 001 1 000033 000033 011 000033 016 RNF7031 I 00 047 The name or indicator SQLER5 is not referenced.
ERROR 0 001 1 000035 000035 011 000035 017 RNF7031 I 00 048 The name or indicator SQLERRD is not referenced.
ERROR 0 001 1 000037 000037 011 000037 016 RNF7031 I 00 047 The name or indicator SQLWN0 is not referenced.
ERROR 0 001 1 000038 000038 011 000038 016 RNF7031 I 00 047 The name or indicator SQLWN1 is not referenced.
ERROR 0 001 1 000039 000039 011 000039 016 RNF7031 I 00 047 The name or indicator SQLWN2 is not referenced.
ERROR 0 001 1 000040 000040 011 000040 016 RNF7031 I 00 047 The name or indicator SQLWN3 is not referenced.
ERROR 0 001 1 000041 000041 011 000041 016 RNF7031 I 00 047 The name or indicator SQLWN4 is not referenced.
ERROR 0 001 1 000042 000042 011 000042 016 RNF7031 I 00 047 The name or indicator SQLWN5 is not referenced.
ERROR 0 001 1 000043 000043 011 000043 016 RNF7031 I 00 047 The name or indicator SQLWN6 is not referenced.
ERROR 0 001 1 000044 000044 011 000044 016 RNF7031 I 00 047 The name or indicator SQLWN7 is not referenced.
ERROR 0 001 1 000045 000045 011 000045 016 RNF7031 I 00 047 The name or indicator SQLWN8 is not referenced.
ERROR 0 001 1 000046 000046 011 000046 016 RNF7031 I 00 047 The name or indicator SQLWN9 is not referenced.
ERROR 0 001 1 000047 000047 011 000047 016 RNF7031 I 00 047 The name or indicator SQLWNA is not referenced.
ERROR 0 001 1 000048 000048 011 000048 017 RNF7031 I 00 048 The name or indicator SQLWARN is not referenced.
ERROR 0 001 1 000050 000050 011 000050 016 RNF7031 I 00 047 The name or indicator SQLSTT is not referenced.
ERROR 0 001 1 000061 000061 015 000061 026 RNF7031 I 00 051 The name or indicator SQLCLSE... is not referenced.
ERROR 0 001 1 000065 000065 015 000065 026 RNF7031 I 00 051 The name or indicator SQLCMIT... is not referenced.
ERROR 0 001 1 000057 000057 015 000057 026 RNF7031 I 00 051 The name or indicator SQLOPEN... is not referenced.
ERROR 0 001 1 000104 000104 007 000104 010 RNF7030 S 30 042 The name or indicator TEST is not defined.
ERROR 0 001 1 000083 000083 010 000083 014 RNF7031 I 00 047 The name or indicator FIE1D2 is not referenced.
ERROR 0 001 1 000083 000083 010 000083 014 RNF7031 I 00 047 The name or indicator FIE1D3 is not referenced.
ERROR 0 001 1 000083 000083 010 000083 014 RNF7031 I 00 047 The name or indicator FIE1D4 is not referenced.
ERROR 0 002 1 000009 000009 008 000009 013 RNF7031 I 00 047 The name or indicator VSCODE is not referenced.
ERROR 0 001 1 000104 000104 007 000104 010 RNF7503 S 30 051 Expression contains an operand that is not defined.
ERROR 0 001 0 000000 000000 000 000000 000 RNS9308 T 50 057 Compilation stopped. Severity 30 errors found in program.
FILEEND 0 001 000109
I think that might be because the the nested includes aren't included. As there are no dependencies on anything in the includes in my example, they're just there to create a minimum viable example, then that's probably why it compiles without the *LVL2 option. If you modded the example to use something from the VSCODEINC2 file then I daresay it wouldn't compile without *LVL2.
Adding a reference to myds_t from VSCODEINC2 was still displaying correct errors without LVL2:

Is this what you were referring to?
You need the make the SQL code dependent on the nested include, so something like this:
VSCODEINC2
**FREE
/if defined (VSCODE2)
/eof
/endif
/define VSCODE2
dcl-ds myDs_t qualified template;
count int(10);
end-ds;
VSCODE
**FREE
ctl-opt copyright('')
datfmt(*ISO) datedit(*YMD/) timfmt(*ISO)
debug(*YES) option(*NODEBUGIO: *SRCSTMT)
main(main);
/include qrpglesrc,VSCODEINC
//**************************************************************************************************
// Entry point
//**************************************************************************************************
dcl-proc main;
dcl-pi *N;
end-pi;
dcl-ds myDs likeds(myDs_t);
exec sql
select count(*) into :myDs from QSYS2.SYSTABLES;
// if test = *ON;
// endif;
end-proc;
//**************************************************************************************************
This will fail if not compiled with *LVL2.
@fathert Got you.
Thanks for raising it. I am gonna spend some of my weekend working on it. Got a busy day today but will get my head down into it ASAP.
Great, thanks for looking at it and for your hard work getting it to work at all! I'm looking forward to being able to use VS Code as my daily editor 😄
I have recreated the issue in this JSFiddle in case anyone else wants to have a go at the issue.
Specifically, it's the getErrors function that needs work.
https://jsfiddle.net/4fa9je1o/1/
The expected result is errors in more than just one file.
@fathert I actually think I've solved it.

The fix will be coming out tonight or tomorrow, but it will be an optional fix that will have to be turned on. I am afraid of just swapping them out and breaking it for all the other listings - although I've tested it and it looks okay.. I want to be extra safe.
Oh that's great, I meant to have a look over the weekend, but never got the time. Thanks very much, I look forward to trying it!
@worksofliam Hi Liam, here is the official documentation of the EVFEVENT file format. So sorry it took me this long to find it. https://www.ibm.com/docs/en/rdfi/9.6.0?topic=reference-events-file-format
Hopefully this will tell you that you did it all right :-)
Thought I'd share an update as my day comes to an end and I have a beer to dwell.
This fix is surprisingly tedious. I got a bunch of code done and got it working as expected with the code sample provided by @fathert. Then I tried with other code bases and not having much luck. There is a lot of edge cases to test and it's going to be a little bit before it's released.
I suspect I'll share the branch tomorrow.
We have a lot of SQLRPGLE code with lots of deep nesting, I'm happy to beta test something if that would help?
@fathert Funnily enough, it seems to work perfectly when there is deep nesting. Otherwise, it's one or two lines off... will have to keep working on this tonight and over the weekend.
Will keep you posted.
I have been working on this for days, and I’m getting very close, but I’m working out the kinks for the expansion keyword. Turns out, it doesn’t just expand, it can also delete lines. I didn’t know that until yesterday. Awfully stressful.
I had to take a break yesterday and today because I was just getting frustrated. I will continue tomorrow sometime and post another update.
Monday update: I got it working over the weekend. I hate the way the source maps are implemented for the compilers.
There will be a release tonight, and you must enable this fix since I don't want to disturb existing situations. When everyone is happy with the fix, then it will be released as the default.
Liam
@fathert
The fix preview is out in 0.8.3. Open the VS Code settings, search for error parser, enable it, and then compile away.

Please, of course, post any feedback here.
So far, so good Liam, I'll keep using it over the next few days and let you know how it goes.
So did we determine that this fixed for RPGPPOPT(*LVL2) or does it need to be RPGPPOPT(*NONE)? After enabling the fix, I just tried with *LVL2 and encountered the same issue on a source today. Switched it to *NONE to get it to reference the appropriate line, but I know that was causing some other issues in certain scenarios.
@cbuck0222
If you're still having the same issue, please share some source code that I can recreate it with. Thanks.
Here's my program and the copybooks. There's quite a few /includes and dependencies. So I'm not sure what all you'll need. Just let me know if I'm missing anything. I'm also VERY new to github, so forgive me if there's a better way of sharing this that I'm not aware of. I'm sort of pioneering these tools for our predominantly IBM i shop. Not quite sure why some of my paste is getting recognized as code and other lines are not.
I am attempting to compile using CRTSQLRPGI command.
QRPGLESRC/VRR3000
**free
//==============================================================================
// C O M P I L E R O P T I O N S
//==============================================================================
ctl-opt
dftactgrp(*NO)
option(*nodebugio:*srcstmt)
extbinint(*yes);
//==============================================================================
// F I L E D E F I N I T I O N S
//==============================================================================
// 21st UI Header and Background
dcl-f SYD8500D workstn
extFile(*EXTDESC) extDesc('SYD8500D')
handler('PROFOUNDUI(HANDLER)');
// Variable Rate Index Queue
dcl-f VRD3000 workstn extDesc('VRD3000')
usage(*INPUT:*OUTPUT)
sfile(dsasf1:sfrra1)
handler('PROFOUNDUI(HANDLER)');
//==============================================================================
// E X T E R N A L P R O C E D U R E S
//==============================================================================
// UI Message Pop-up
/include qcpylesrc,syr8501_pr
//==============================================================================
// D A T A S T R U C T U R E S
//==============================================================================
// Program status data structure
/include qcpylesrc,gcpyr004
//==============================================================================
// G L O B A L V A R I A B L E S
//==============================================================================
// Program flow
dcl-s endProgram ind inz(*off);
dcl-s sfrra1 int(5);
//==============================================================================
// G L O B A L C O N S T A N T S
//==============================================================================
dcl-c true '1';
dcl-c false '0';
dcl-c pass '1';
dcl-c fail '0';
dcl-c clicked '1';
// constants for SQLSTATE class values
dcl-c stmtOk '00';
dcl-c stmtWarning '01';
dcl-c stmtError '02';
// Setup SQL Environment
exec SQL
set option commit = *none
, dlyprp = *no
, cloSQLCsr = *endmod
, datFmt = *iso
, naming = *sys;
//==============================================================================
// M A I N
//==============================================================================
initialization();
dow not endProgram;
show_screen('DSACT1');
select;
// 'Exit' button
when btnExit = clicked;
endProgram = true;
// 'See Confirmed Today' button
when btnSeeConf = clicked;
// do this
endsl;
enddo;
//------------------------------------------------------------------------------
// Exit program
//------------------------------------------------------------------------------
*inlr = *on;
return;
//==============================================================================
// S U B P R O C E D U R E S
//==============================================================================
//------------------------------------------------------------------------------
// Procedure: initialization
// Description: Intializes program
//------------------------------------------------------------------------------
dcl-proc initialization;
// Set Heading informational values
wdwTitle = 'Servicing';
wdwPnlDesc = 'Rate Index Queue';
wdwUser = psdsCurrUser;
// Set Default Button panel height and width
btnPnlHgt = 720;
btnPnlWdth = 160;
// Set Default Content panel height and width
cntPnlHgt = 720;
cntPnlWdth = 1100;
wdwTtlWdth = cntPnlWdth; // Window title width
// Set Default Window Title LEFT starting position
wdwTtlLeft = 160;
// Set Default Window Info(display,user) LEFT starting positions
wdwInfLeft = 1118;
showLogo = true; // Show Logo
end-proc;
//------------------------------------------------------------------------------
// Procedure: show_screen
// Description: Displays the desired record format
//------------------------------------------------------------------------------
dcl-proc show_screen;
dcl-pi *n;
recordFormat char(10) const;
end-pi;
// Configure display format information
wdwPgmFmt = %trimr(psdsProgName) +':'+ recordFormat;
// Write 21st UI background & header
write window;
// Determine which record format to display
select;
when recordFormat = 'DSACT1';
clear_indexSubfile();
load_indexSubfile();
exfmt dsact1;
endsl;
end-proc;
//------------------------------------------------------------------------------
// Procedure: clear_indexSubfile
// Description: Clears the rate index queue subfile
//------------------------------------------------------------------------------
dcl-proc clear_indexSubfile;
clear sfrra1;
clear sfrna1;
sfclr1 = *on;
write dscat1;
sfclr1 = *off;
end-proc;
//------------------------------------------------------------------------------
// Procedure: load_indexSubfile
// Description: Loads the rate index queue subfile with records from...
//------------------------------------------------------------------------------
dcl-proc load_indexSubfile();
end-proc;
//=======================================================================
// Procedure name: SQLError
// Purpose: Monitor for SQL Errors
// Displays Popup notification if SQL error
// occurs.
// Returns: SQLError=True(1)/False(0)
// Example:
// If not SqlError(' on Object Update');
//=======================================================================
/include qcpylesrc,syr8502_c
QCPYLESRC/SYR8501_PR
// Prevent duplicate /INCLUDEs.
/IF NOT DEFINED(SYR8501_PR)
/DEFINE SYR8501_PR
/ELSE
/EOF
/ENDIF
//===================================================================
// PROTOTYPES
//-------------------------------------------------------------------
// popUp(): Show message to customer in pop-up
// Parms:
// input psdsProgName - Program name of calling program
// input Message Type - EMAIL,CONFIRMED,INFORMATION,WARNING,ERROR,DEBUG
// input Message - Message Text
// input Message length -
D popUp PR EXTPGM('SYR8501')
D iProgram 10a Const
D iMessageType 12a Const
D iMessage 1024a Const Options(*VARSIZE)
D iLength 10i 0 Const
// Message variable
D MsgStr S 1024a
QCPYLESRC/SYR8502_C
P*--------------------------------------------------
P* Procedure name: SQLError
P* Purpose: Monitor for SQL Errors
P* Displays notification if SQL error
P* occurs.
P* Dependencies:
P* Popup(); // Pop-up message prototype:
P* /include qcpylesrc,SYR8501_PR
P*
P* Receives: Additional error text
P*
P* Returns: SQLError=True(1)/False(0)
P*
P* Example:
P* If not SQLError('on Customer Update')
P*--------------------------------------------------
P SQLError B
D PI Like(Result)
// Optional messaging area for additional details of error
// (procedure name, function name, etc.)
D ErrorDetails 256a const options(*nopass)
D Result S N
/free
Result = False;
// Notify of failure.
If SqlCod <> 0 and SQLCod <> 100;
Result = True;
msgStr = 'Operation failed. Please report problem to support. ' +
'Error Code:' + %Char(SQLCOD) + ' ' +
ErrorDetails;
popUp(psdsProgName:'WARNING':msgStr:%Size(msgStr));
EndIf; // SqlCod <> 0
Return Result;
/end-free
P SQLError E
QCPYLESRC/GCPYR004
*---------------------------------------------------------------------
* Program Status Data Structure
*---------------------------------------------------------------------
* Program status data structure
D PSDS SDS
* Program name (*PROC) / main procedure name
D psdsProgName 10A
* Status code (*STATUS, %status)
D psdsStatus 5S 0
* Previous status code
D psdsPrevStat 5S 0
* RPG source statement number
D psdsSrcStmNbr 8A
* RPG routine name in which exception/error occurred (*ROUTINE)
D psdsExRoutine 8A
* Number of parameters passed to this program (*PARMS, %parms)
D psdsNbrParms 3S 0
* Exception type (e.g., CPF or MCH)
D psdsExType 3A
* Exception number (CPF message number or MCH exception number)
D psdsExNbr 4A
* Reserved
D psdsReserved1 4A
* Work area for messages
D psdsReserved2 30A
* Library in which program is located
D psdsProgLib 10A
* Retrieved exception data. Contains
* CPF messages when psdsStatus = 09999
D psdsExData 80A
* Identification of the exception that cause RPG9001 (the called
* program failed).
D psdsExRPG9001 4A
* Name of file on which the last file operation occurred (updated
* only when an error occurs).
D psdsErrFile 10A
* Unused
D psdsReserved3 6A
* Date Job Entered system
D psdsDtEntSys 8A
* First 2 digits of *Year
D psdsCentury 2S 0
* Name of file on which last file operation occurred (updated
* only when an error occurs).
D psdsLastOpFl 8A
* Status information on the last file used. Includes status code,
* RPG routine name, statement number, and record name. Updated only
* when an error occurs.
D psdsLstFlStat 35A
* Job name
D psdsJobName 10A
* User name
D psdsJobUser 10A
* Job number
D psdsJobNumber 6S 0
* Date (in UDATE format) job entered system (UDATE is derived
* from this)
D psdsUDtEntSys 6S 0
* Date of program execution (system date in UDATE format)
D psdsPgmExDate 6S 0
* Time of program execution in hhmmss format
D psdsPgmExTime 6S 0
* Date of program compilation in UDATE format
D psdsCmpDate 6A
* Time of program compilation in hhmmss format
D psdsCmpTime 6A
* Compiler level
D psdsCmlLvl 4A
* Source file name
D psdsSrcFile 10A
* Source file library name
D psdsSrcLib 10A
* Source file member name
D psdsSrcMbr 10A
* Program Containing Procedure
D psdsPgmProc 10A
* Module Containing Procedure
D psdsModProc 10A
* Source ID matching the statement number from field psdsSrcStmNbr
D psdsSrcID 2B 0
* Source ID matching the statement number from field psdsLstFlStat
D psdsSrcID2 2B 0
* Current user profile name
D psdsCurrUser 10A
* Unused
D psdsReserved5 62A
@cbuck0222 I cleaned it up for you.
This should be enough to work with, and from a glance, I can see it's likely due to the copybook at the end.
Would you mind also sharing this info:
- Do you have the new parser enabled?
- Could you please share a screenshot of where the errors are appearing in your editor
@worksofliam thanks. For future reference, could you tell me what you did to make sure the correct lines got formatted as "code"?
And yes, I have the new parser enabled:

For an easy one, the error is that my record format dsact1 is spelled incorrectly, "dscat1". It's referencing line 134 though. Should be on 176 in the editor.

@cbuck0222
You can use three backticks. See example here: https://docs.github.com/en/github/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax#quoting-code
@cbuck0222 Can you also share the entire compile command you're using?
@worksofliam CRTSQLRPGI OBJ(&OPENLIB/&OPENMBR) SRCFILE(&OPENLIB/&OPENSPF) CLOSQLCSR(*ENDMOD) OPTION(*EVENTF) INCFILE(*LIBL/*SRCFILE) RPGPPOPT(*LVL2) TGTRLS(V7R4M0) REPLACE(*YES) SQLCURRULE(*DB2) DBGVIEW(*SOURCE)
@cbuck0222 Thanks! I see that if I take *LVL2 off, it shows the errors as expected correct - which is good. Investigating the level two stuff later this evening.
edit: note to self - it absolutely is that copy book at the bottom.
Yep, just tried compiling with moving the copybook to the top of my subprocedures and it worked with *LVL2.