Using IBM i? Need to create Excel, CSV, HTML, JSON, PDF, SPOOL reports? Learn more about the fastest and least expensive tool for the job: SQL iQuery.
061900 if CusNr = 17570000 and Group = '291' or : 063900 CusNr = 13057710 and Group = '001'; 063901 CusNr = 00077837 or 063902 CusNr = 00042059 or 063903 CusNr = 00071625 or : 063908 CusNr = 00079357 and 063909 %scan(Group : '001 002 021') <> 0 or 063910 CusNr = 00077787 and 063911 %scan(Group : '087 329') <> 0; *RNF7416 30 063909 The types of the right and left hand side do not match in the EVAL operation.
Took me ages to figure out that I'd not changed the semi-colon at line 63900 to "or", so that the If statement was extended by the new conditions. But really? The compiler decided that the error was on the %scan line, that was part of the unintentional eval that began at 63901 and extends to 63911?? Ok, I finally understood what the error was when I paged back far enough to find the semi colon, but could we report either the first occurrence of bad logic (or last), just not one in the middle!!
Neil, this too was discussed during our training at your location. I actually poke fun at the compile. I've got to get more interesting when I talk about this stuff--to keep you awake.
Yeah, I got used to the compiler complaining the line below the bad statement, and I remember that part of the talk - sometimes you have an error and the compiler decides it's the next line that is really in error.
I'm just bemused that the compiler also seems to have a random number generator attached to the "pick which line to report the error for" routine. I looked back at the code and there is a similar "CusNr = AND %scan" on lines 63906/63907. Why pick 63909? It's more logical to pick 63902, the first occurrence of generating *on/*off to eval into a numeric field, or maybe 63911 the last line of the eval.
Ah! But I do see the pattern and understand why they did it that way--I don't agree with their decision, but I see why.