× 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.



Actually the problem is in how QCMD (the command line interface)
allocates space for parameters typed on the command line. All parameters
are passed by reference on CALL. QCMD allocates a space for each
parameter, copies the typed input to the spaces and then passes the
program a pointer to each space. It will always allocate at least 32
characters. If the typed character string is longer than 32, it
allocates EXACTLY that many characters. If the called program is
expecting more characters than you typed, you'll get whatever is in
memory after the space QCMD allocated.

When you build a CMD object, you specify how big the spaces should be.
It's easy for you to match the command to your program. QCMD from the
command line has no idea how big your parameters are supposed to be.


-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx
[mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of Scott Klement
Sent: Monday, October 06, 2008 12:04 PM
To: Midrange Systems Technical Discussion
Subject: Re: CLP CALL from the command line

Hello,

I've been reading about the problem of calling a CLP with parameter
that's more than 32 characters long. To call it from the command line
is it reasonable to add a second parameter *DEC 15 5 to tell it how
long the parameter actually passed is ?

Adding a second parameter is certainly a reasonable solution -- that's
that IBM did with the QCMDEXC API, in fact.

However, I'd suggest that if the caller is a human being typing data at
the command-line, it'd be very cumbersome to always have to count the
number of characters. And it'd be error prone, since it's easy to count
it wrong.

An easier solution is to put a *CMD front-end on your program. It takes
only a little more work to write the CMD source, but as long as the user
runs the command, it solves the problem entirely, and is much more
user-friendly.

One more note... this is a little thing... but, the problem has
nothing to do with CLP. This same problem occurs with ANY language that
you're calling, whether it be CLP, CLLE, RPG, RPGLE, CBLLE, etc. It
doesn't matter... the "problem" (if you want to call it a problem) is
in the way i5/OS program calls pass parameters.
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing
list To post a message email: MIDRANGE-L@xxxxxxxxxxxx To subscribe,
unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx Before posting, please take a
moment to review the archives at http://archive.midrange.com/midrange-l.




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.