|
> From: M. Lazarus > > I think that this code will give you an error. You need OPTIONS( > *VARSIZE ) on the Cmd definition. Otherwise you will get the leading 2 > characters (binary length of varying variable) being passed to QCMDEXC.
No you won't, which is sort of the point of the post. CONST allows the compiler to make conversions, including between VARYING and non-VARYING fields.
Rather than guess, give it a try first. And while I know most people aren't sick and twisted like me and have access to a machine on the weekend, at the same time you might want to take the time to test before throwing FUD on the fire.
Here's the working code, which I did take the time to test:
DQcmdexc PR EXTPGM('QCMDEXC') D Cmd 128 const D CmdLen 15 5 const
D command s 128 varying
C eval command = 'SNDMSG ''HELLO'' QSYSOPR' C callp Qcmdexc(command:%len(command))
C eval *inlr = *on
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.