Hi Mike,
%USERPROFILE% typically evaluates to a directory name with spaces in it.
For Example, in my WinXP Pro box, it evaluates to:
C:\Documents and Settings\Scott
The problem this causes is that blanks in a command string are treated
as parameter separators. When all is said and done, your command looks
like this (should be one line -- please forgive that the e-mail software
wraps it):
copy \\192.168.0.200\exportfiles\customersbysalesperson.csv c:\Documents
and Settings\whomever\Documents
The "copy" command is expecting two parameters, an from file and a
destination file. Trouble is, you're passing it 4 parameters, because
each blank is treated as a parameter separator. So your "from" file is
okay, but your destination file looks like 3 separate parameters to the
copy command. And this results in the message "The syntax of the
command is incorrect."
A simple fix is to add double quotes:
ExecClCmd('CALL PGM(RUNPCCMD) ' +
'PARM(''copy \\192.168.0.200\exportfiles\' +
'customersbysalesperson.csv ' +
'"%USERPROFILE%\Documents"'')');
Now the destination filename is all a single parameter (due to the
quotes) "c:\documents and settings\scott\Documents"
However -- I suspect you really wanted this to go into a *folder* named
documents (instead of creating a file with that name). In Windows XP,
that folder would be named "My Documents" (not just Documents) correct
me if I'm wrong. So you really want this:
ExecClCmd('CALL PGM(RUNPCCMD) ' +
'PARM(''copy \\192.168.0.200\exportfiles\' +
'customersbysalesperson.csv ' +
'"%USERPROFILE%\My Documents"'')');
I don't know if that folder is still named "My Documents" in Vista or
Win7, though... You'd probably know that better than I do. But if it's
different on different versions of Windows, then you have another
challenge...
On 2/2/2012 10:37 PM, Mike Wills wrote:
I have a CSV I have created on the IFS that I am trying to copy to their desktop via PCO. They told me the following:
"The PCO session A command prompt screen comes up. It says" The syntax of the command is incorrect. Press any key to return." I hit return and the screen goes blue and then returns to menu. Nothing shows up in my Docs."
I am not sure where to continue looking since I don't have access to their PC. They are on Windows XP. Here is what I am doing:
ExecClCmd('CALL PGM(RUNPCCMD) ' +
'PARM(''copy \\192.168.0.200\exportfiles\' +
'customersbysalesperson.csv %USERPROFILE%\Documents'')');
RUNPCCMD.CLLE
PGM PARM(&CMD)
DCL VAR(&CMD) TYPE(*CHAR) LEN(120)
STRPCO
MONMSG MSGID(IWS4010)
STRPCCMD PCCMD(&CMD) PAUSE(*YES)
ENDPGM
This works on my PC (Windows Vista), but not theirs. Any thoughts?
--
Mike Wills
http://mikewills.me
As an Amazon Associate we earn from qualifying purchases.