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



YOUR proc will always make a copy of the passed-in command string. That's
what VALUE does for you. It also gives your proc's caller the ability to
pass, literals, fixed-length fields or varying fields as the parameter with
the command string in it.

You could probably use CONST instead of VALUE for your proc and then you'd
only have an occasional situation when a copy of the parameter is made.
The "best" solution is calling QCMDEXC directly if you don't like the second
parm, call the system() function.  The complete prototype for QCMDEXC is on
the www.rpgiv.com website on the downloads page, as is the C runtime
prototype for the system() function.

-Bob Cozzi
www.RPGxTools.com
RPG xTools - Enjoy programming again.

-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx]
On Behalf Of David Keck
Sent: Tuesday, August 30, 2005 9:55 AM
To: rpg400-l@xxxxxxxxxxxx
Subject: Unprototyped Dynamic Call with Varying Parameter



The procedure below produces correct results.  For example, the following
code causes the DSPLIBL screen to be displayed.
/free
      Command('DSPLIBL');
/end-free

CmdStr is defined as a varying string (2 leading bytes containing the
string length followed by 4096 data bytes).

Question: Does the address of CmdStr point to the first byte of the two
byte string length?  If so, what rule tells the compiler that the
unprototyped call to QCMDEXC is to have the address of the CmdStr parameter
offset by the two bytes? Would it be more efficient to define CmdStr with
OPTIONS(*VARSIZE) instead of VARYING? Why?


*--------------------------------------------------------------------------
     P Command         B                   export
     D Command         PI
     D  CmdStr                     4096A   value varying

      *- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- -

      * some error trapping should be implemented here at some point
      * like a return code, job log message, errorlog file msg, etc.
     C                   callp(e)  QCMDEXC( CmdStr  : %Len(CmdStr))
     C                   return

     P Command         E

*--------------------------------------------------------------------------


Thanks, Dave

David Keck
NBTY, Inc
Phone (631) 200-5809
DavidKeck@xxxxxxxxxx 
This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-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.