By the way...this happened to me consistently for about 3 hours this morning
when I was trying figure out what was going on. I had logged off and on
multiple times in between also, and I had several instances of debug going
as well at different times.
Also, the code I posted here was the absolute distilled version from what I
started with, where the original code (that had the same error) was also
calling other programs (some under debug, some not).
It did finally work without errors when I logged off the last time, logged
back on again and did NOT start a debug session first.
I don't know why (or can't imagine why) debug would make a difference on
this as it never has before, but I'm equally sure I don't understand
everything that was going on during a debug session under the covers either.
Also, it wasn't always QGPL as the library to add. Originally I had a
different library in there, not that that makes a difference, but in the
interest of full disclosure...
I am baffled why this would cause a pointer error today across so many
interactive sessions that I ran, but there you go.
No new PTFs in months either, btw.
I'm am sure it is something I did incorrectly. I just don't know what it
was. Guess I may never know unless it happens again and I can glean more
information from it.
Thanks again all for considering the problem. At least it gave you
something different to think about besides the crappy economy for awhile.
:-)
Shannon O'Donnell
-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx]
On Behalf Of Scott Klement
Sent: Tuesday, December 30, 2008 1:15 PM
To: RPG programming on the IBM i / System i
Subject: Re: Driving me nuts!
Vern Hamberg wrote:
Shannon - you might have got hit by a problem with literals when calling
programs - you have 2000 as the length - might have junk somewhere in
that length - after the command you are trying to run.
With all due respect... what did he do in his code that risks having
junk in his command?!
Here's what he has defined:
d CmdString s 2000A
This will reserve 2000 bytes of memory and set it to blanks, won't it?
No junk here.
C Eval cmdString = 'ADDLIBLE LIB(QGPL)'
This sets the first 18 bytes to the ADDLIBLE command, and sets the
remaining 2000 bytes to blanks, right? Where would junk get in?
D cmd PR ExtPgm('QCMDEXC')
D command 2000A const
D length 15P 5 const
. . .
C Callp(e) cmd(CmdString:2000)
This passes the 2000 byte parameter, and the number 2000 to the API. I
don't see any way junk could get in here...
The fact it works now is just luck, IMO.
I don't mean to be a jerk... but when you get garbage in a literal, it's
for a VERY SPECIFIC reason. The times when it occurs are well-defined,
and easily understood by a programmer. You don't just randomly get junk
in a character string willy-nilly.
Since he's not doing any of those things that cause junk, why do you say
this? Did you spot something that I did not?
As an Amazon Associate we earn from qualifying purchases.