|
Please excuse my stepping so slowly. I want to be sure I don't make invalid assumptions since this is not clear to me yet. May we stay in the fixed format for this as FREE is just one more possible point of failure for me? Can my main program be correct and complete as far as a sub procedure is concerned if it has only these two lines?: D/copy protosrc,pDoCmd .... C callp (e) docmd('WRKSPLF') -------------------------------------------------------- Booth Martin http://www.MartinVT.com Booth@xxxxxxxxxxxx --------------------------------------------------------- -------Original Message------- From: RPG programming on the AS400 / iSeries Date: Friday, October 24, 2003 1:41:18 PM To: rpg400-l@xxxxxxxxxxxx Subject: Re: Starting out with sub-procedures ...You could easily write a wrapper procedure that takes one CONST VARYING string parameter, that computes the length of that command and passes it on to QCMDEXC: -------------------------------------------------------- P doCmd b D doCmd pi D Command 1000a const varying D QCmdExc pr extpgm('QCMDEXC') D 1000a const D 15p 5 const /free qcmdexc(Command:%len(Command)); /end-free P doCmd e -------------------------------------------------------- Thus demonstrating another advantage of procedures: Simplifying the calling of complex API's. In other words, converting the interface of some procedure into a different interface that's somehow better. In this case, the caller doesn't have to work out the length. Compare: doCmd ('CHGJOB DATFMT(' + fmt + ')'); ... Cheers! Hans
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.