×

Good News Everybody!

The new search engine is LIVE!

Please report any problems to david (at) midrange.com.




You are confused... the example was wrapping QCMDEXC so that you don't have
to pass in the length of the command string.
I would, of course, just use the system() function (a C language function)
which doesn't even require the cmd string length.


Bob Cozzi
Cozzi Consulting
www.rpgiv.com


-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx]
On Behalf Of Dave Boettcher
Sent: Monday, October 27, 2003 10:43 AM
To: 'RPG programming on the AS400 / iSeries'
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 thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2026 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.