|
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.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.