STRPCCMD is a fine thing to run PC programms on my PC from the iSeries. But
the command string can only be 123 characters long. This ist not enough,
when I want to print a word document by MS Word, which is located in a huge
directory structure.
There's about a million and a half different solutions to this problem.
a) You can work around the 123 character limitation by creating a batch 
file.  You can even create it on-the-fly with STRPCCMD if you like. For 
example:
STRPCCMD PCCMD('cmd /c ECHO SET MYDOC=c:\documents and settings> 
C:\DATA\MYFILE.BAT')
STRPCCMD PCCMD('cmd /c ECHO SET MYDOC=%MYDOC%\alexander.acctdom\my documents>> 
C:\DATA\MYFILE.BAT')
STRPCCMD PCCMD('cmd /c ECHO SET MYDOC=%MYDOC%\weekly\credit memos\acme inc>> 
C:\DATA\MYFILE.BAT')
STRPCCMD PCCMD('cmd /c ECHO SET MYDOC=%MYDOC%\memo84612.doc>> 
C:\DATA\MYFILE.BAT')
STRPCCMD PCCMD('cmd /c ECHO start %MYDOC%>> C:\DATA\MYFILE.BAT')
STRPCCMD PCCMD('C:\DATA\MYFILE.BAT')
b) The biggest problem with the above method is that it only works with 
Client Access (errr.. iSeries Access.) It's rather proprietary, though 
for some reason that doesn't seem to bother iSeries people. For something 
less proprietary, use RUNRMTCMD.
To do that, you need to have an Rexec ("Incoming Remote Command") service 
running on the Windows box, there's one included with iSeries Access, and 
there's also many 3rd party ones available, search the Internet for more 
info on these.  Search the archives of this mailing list for info on how 
to start the service.
Once you've done that, you need to obtain the IP address of the PC that's 
connected.  You can get this with the QDCRDEVD API.  Again, search the 
archives of this mailing list, complete code samples have been posted at 
least 4 times that I know of.
Once you've got that, you can simply use RUNRMTCMD with *IP to run teh 
command.
c) RUNRMTCMD with *IP uses the REXEC protocol. There's an rexec() API that 
you can call as an alternative to the command.  One of the big advantages 
is that it's capable of receiving responses back from the programs and 
checking for errors on the remote side.  RUNRMTCMD does the same thing, 
but the output goes to a spooled file instead of to your program which may 
not be way you want.  So, check out the rexec() API.
I wrote an article that demstrates this API from an ILE RPG program. 
A search on iSeriesNetwork.com should locate that article.
d) QShell also has the ability to use the REXEC protocol (as do all of the 
Unixes, and many of the versions of Windows, including XP) via the rexec 
command.
Look up the rexec command in the QShell utilities reference manual in the 
Information Center for details.  Here's a link to that:
http://publib.boulder.ibm.com/iseries/v5r2/ic2924/info/rzahz/rexec.htm
e) Change your application to use a web interface instead of a 5250 green 
screen.  This'll be nicer than drab awful green screen to begin with, and 
has the native ability to have hyperlinks that open a document.
There are MANY other alternatives as well. SSH comes to mind, though I'm 
not sure how well you can use that with Windows, it would work great with 
Linux or BSD or OS X. I could probably list another half dozen ways, but 
the REXEC and STRPCCMD ones are by far the most common on the iSeries.
 
As an Amazon Associate we earn from qualifying purchases.
	
 
This mailing list archive is Copyright 1997-2025 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.