|
In this example, you don't need a PI. You are just PRototyping the call to QCMDEXC. But, if you wish to write a wrapper to QCMDEXC, you would need a PI. Thanks, Mark Mark D. Walter Senior Programmer/Analyst CCX, Inc. mwalter@xxxxxxxxxx http://www.ccxinc.com |---------+-----------------------------> | | Dave Boettcher | | | <DBoettch@xxxxxxxx| | | ha.wi.us> | | | Sent by: | | | rpg400-l-bounces@m| | | idrange.com | | | | | | | | | 10/27/2003 11:42 | | | AM | | | Please respond to | | | RPG programming on| | | the AS400 / | | | iSeries | | | | |---------+-----------------------------> >------------------------------------------------------------------------------------------------------------------------------| | | | To: "'RPG programming on the AS400 / iSeries'" <rpg400-l@xxxxxxxxxxxx> | | cc: | | Subject: RE: Starting out with sub-procedures | >------------------------------------------------------------------------------------------------------------------------------| Buck, I am confused, I should say more confused than normal. Looking back at the last time I used QCMDEXEC, I cannot find that I used the PI specs. Why are they needed? Here is what I used: D Cmd PR ExtPgm('QCMDEXC') D command 200A const D length 15P 5 const and then c callp Cmd('DLTOVR FILE(qsqlsrc) LVL(*JOB)':200) Is the CALLP the difference? Dave Boettcher -----Original Message----- From: Buck [mailto:buck.calabro@xxxxxxxxxxxx] Sent: Monday, October 27, 2003 10:00 AM To: rpg400-l@xxxxxxxxxxxx Subject: Re: Starting out with sub-procedures > 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') Not quite. Presuming that we're still talking about a pure /copy regime, and not service programs. What we need is a second /copy, for the 'pi' part. The reason for that is the compiler doesn't know how to sort the D-specs. If we mix the PR and PI specs in one /copy member, the compiler will put the PI specs before the calculations, which is a no-no. Here's one way to do the full thing, based on prior posts: ======================= QPROTOSRC, member AAAAS * Wrapper to process OS400 commands D doCmd pr D Command 1000a const varying ======================= QRPGLESRC, member AAAAS p doCmd b export D doCmd pi D Command 1000a const varying D QCmdExc pr extpgm('QCMDEXC') D 1000a const D 15p 5 const c callp qcmdexc(Command:%len(Command)) P e ======================= QRPGLESRC, member AAAA h dftactgrp(*no) actgrp('QILE') /copy qprotosrc,aaaas c callp(e) DoCmd('WRKSPLF') c eval *inlr=*on /copy qrpglesrc,aaaas ======================= Compile AAAA and call it. You should be able to see your spooled files! As interesting side-note is that the procedure DoCmd defines the procedure QCMDEXC, so there's no need for a second PR spec in the QPROTOSRC /copy member! Neat, eh? --buck _______________________________________________ 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. _______________________________________________ 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 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.