COGNOiSe.com - The IBM Cognos Community

Planning & Consolidation => COGNOS Planning => Topic started by: StuartS on 29 Apr 2015 04:41:18 AM

Title: Execute Command Line Macro step in CAC Macro
Post by: StuartS on 29 Apr 2015 04:41:18 AM
Hello

Environment Cognos Planning 10.1.1 FP1.

I have created a macro to run a command linestep.  I am executing a bat file directly, not using cepbatch. 

The bat file runs, but the XCOPY in the bat file does not.  With the script below the running.log, and running2.log files are created but the Xcopy does not run.

@echo off
echo running start > \\server1\share1\running.log
xcopy c:\share1\test.txt c:\share1\folder\ /Y
echo running End > \\server1\share1\running.log

In the CAC I am getting succeeded.

I have tried a mixure of UNC and direct paths on the xcopy, but the result is the same.  I have tried error trapping in the bat file but nothing is produced, i.e. I have used 'if not exist' on the source and target to check permissions.

The Cognos Planning Service runs under a local admin account.  This is a test server so there is no "funny" security, etc..setup.

Any ideas?
Title: Re: Execute Command Line Macro step in CAC Macro
Post by: Danno on 01 May 2015 11:06:12 AM
I can tell you that I have had much better success running batch files via the Analyst Macros. As a result I changed a couple of my processes to work with that. I am definitely interested in knowing if you are able to solve this issue.

Sorry I am not more helpful on this one.
Title: Re: Execute Command Line Macro step in CAC Macro
Post by: StuartS on 13 May 2015 04:25:58 AM
Hello

An update;

I have drawn a blank on why XCOPY does not work in a bat file when executed by the CAC.  The reason for doing this was so I could set a trigger at the end of a publish to enable informatica to run a  process.  Informatica would check a folder/directory at x regularity to find a file.  If the file exists then execute.  I can put a file in the folder using the bat file, just not xcopy it in.

(Using

@echo off
echo running start > \\server1\share1\running.log

)

There may be a more elgant way than this, e.g. even studio, but this is a solution which will work.

Regards

Stuart
Title: Re: Execute Command Line Macro step in CAC Macro
Post by: SomeClown on 22 May 2015 07:28:06 AM
I've found that commands in batch can lag and return a good response code before completing the task.  I used to use VBScript to copy files since the process would hold until completed, but that was not the case with copy/xcopy.

If available, adding a SLEEP nn    to wait nn seconds before completing the batch file sometimes worked to get the previous steps to complete.

I've no experience in Powershell to know if that would work differently.
Title: Re: Execute Command Line Macro step in CAC Macro
Post by: StuartS on 22 May 2015 07:35:04 AM
Thank you