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



Oh man Joel! This is why people have trouble understanding the APIs and
prototypes. 
Your example passes the full 3000 bytes as the command string every time.
That is not necessary. 
Working with your code, it would be "better" to have it as follows:

  d sysCommand      pr                  extpgm('QCMDEXC')
>>d commandString               3000    const   OPTIONS(*VARSIZE)
  d commandLength                 15  5 const
>>d QcmdCmd         s           3000    VARYING
>>d QcmdLength      s             10I 0

Defining QcmdLength this way means you never have to do anything other
than use the parameter name (assuming you populate and use QcmdCmd...)

EX:
    c                   Eval      QcmdCmd = 'RMVLIBLE LIB(CVTSPLV4R1)'
  >>c                   CallP(E)  sysCommand( QcmdCmd : %len(qcmdcmd) )

Summary of changes:
Add OPTIONS(*VARSIZE) to the commandString parameter.
Add VARYING to the CL variable that contains the command to be run.
Change the data type of the QcmdLength variable to 10I0. Since CommandLength
is "const" the compiler will convert the Int4 value into a 15P5 value
automatically (the pleasure of prototyping correctly!).
Changed the 2nd parm value of the CALLP to sysCommand to be the current
length of the no variable length string.

-Bob Cozzi



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
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.