× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Hi Bill,

This code won't actually solve the problem, at least not while you've
still got the %len(%trim(cmd)) in your code.   Sure, you now know where
the end of your string is, but you're not using that to set the length
that's passed to QCMDEXC. :)

The data that comes after "ENDCMD" is still going to be garbage, so unless
ENDCMD is always in positions 2995-3000 of the "cmd" string, your call to
%trim() will always face the chance of picking up "garbage."  (It's
actually not garbage, but rather it's memory that you aren't supposed to
be using)

A better solution (IMHO) than searching for some string would be creating
a *CMD as a front-end to your program.  Something like this should work:

          CMD        PROMPT('MY COMMAND')
          PARM       KWD(CMD) TYPE(*CHAR) LEN(3000) +
                       PROMPT('Command to run')

Now, the operating system knows that it needs to allocate 3000 chars to
use as the parameter, so you won't get the "garbage" that you were getting
before.

At any rate, this question has been asked and answered many times before.
Search the archives or the FAQ, and you'll find lots of ways to work
around the issue.

Good Luck


On Thu, 6 Nov 2003, Bill Hopkins wrote:
> D cmd             S           3000A
> D pos             S              5U 0
>
> c     *entry        plist
> c                   parm                    cmd
> C                   Eval      pos = %scan('ENDCMD':cmd)
> C                   Eval      cmd = %replace(' ':cmd:pos:2999)
> C                   CallP     ExecuteCommand(cmd:%len(%trim
> C                             (cmd)))
> C                   eval      *inlr = *on
> C                   return

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

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.