COGNOiSe.com - The IBM Cognos Community

ETL, App Development and other tools => COGNOS DecisionStream/Data Manager => Topic started by: amichael on 21 Oct 2008 06:33:00 AM

Title: FileCopy, no information if sucessful or not?
Post by: amichael on 21 Oct 2008 06:33:00 AM
Hi,

I'm working with decisionStream for some years, sometimes (and only sometimes) it drives me crazy:

within a Job I need to copy some files.
Until now, I did this with a System-Call:
System( 'copy c:\tmp\start.txt c:\Newfile.txt /y /V' )

unfortunately, there's no chance to see whether the copy was correct finished or aborted due to network trouble for example.

How can I get something like an error-code for the result of the Filecopy?

the same problem occurs for moving files or deleting them, which is also done with the help of system calls.


Regards, Andy
Title: Re: FileCopy, no information if sucessful or not?
Post by: jhleonp on 31 Oct 2008 07:15:43 PM
Hi...
  I´m using w2003 Server and i hade the same problem with xp pro and copy statement.

  In w2003 Server í´m using this, hope is usefull 4 u.

----------------------------------
Declare "res" as integer


$res := System('copy d:\hr.dat d:\temp /Y /v');
Return $res = 0 ;
------------------------------------

XCOPY:
0 success
1 no files found to copy
2 aborted by ^C
4 initialization error (not enough memory or disk space, invalid drive, or syntax error)
5 disk write error
Title: Re: FileCopy, no information if sucessful or not?
Post by: JoeBoxer on 11 Jan 2009 07:36:08 AM
I can vouch for amichael's solution.  its simply a matter of retrieving the status codes from the copy command.