If you are unable to create a new account, please email support@bspsoftware.com

 

News:

MetaManager - Administrative Tools for IBM Cognos
Pricing starting at $2,100
Download Now    Learn More

Main Menu

External Batch job to run CP macros

Started by Cognos_World, 29 Sep 2011 07:41:16 PM

Previous topic - Next topic

Cognos_World

Hello CP Gurus,

I want to run a command line batch script (so that it can be scheduled) which calls the Cognos planning batch job. I am using the commandline cepbatch.exe for the same. My batch job runs and prompts for Cognos signon information. After providing the userid and password, the batch job runs fine.

Here is my batch job command:

C:\CP_path\bin\CepBatch.exe -b -1 "Sales Batch"

Question:

How do I make this batch script run without prompting for the Cognos user id and pwd. I tried both the methods below, but it still asks for the logon info.

C:\CP_Path\bin\CepBatch.exe -b -1 "Sales Batch" -2 myuserid -3 mypwd

C:\CP_Path\bin\CepBatch.exe -b -1 "Sales Batch" -2 "myuserid" -3 "mypwd"

Thanks.



ericlfg

#1
Hi Cognos_World,

In earlier versions you could use either OS signon or basic signon.  In the newer versions (8.2+) you must configure OS signon to accomplish what you're looking for.

From an old 7.3 / 8.1 PDF I have of the Analyst user guide:

Using the Command Line to Run a Macro or Batch Job.
A new batch utility program called CepBatch.exe can be used to run macros or schedule Analyst batch jobs from the command line. This utility program supports both basic signon and Operating System (OS) signon.
The CepBatch.exe program is installed in the Cognos bin folder, generally: C:\Program Files\Cognos\cer4\bin.
Steps
1. Open a command window (or DOS window), and type:
cd C:\Program Files\Cognos\cer4\bin.
2. Type: CepBatch.
3. Type the command line to run a macro or batch job. All arguments containing special characters or spaces must be in double quotes.

Example 1: Run Macro Using Library ID
CepBatch -m -1 LibID -2 MacroName [-3 UID [-4 PWD]] [-5 Language] [-6 LogFile]

For the 8.4 version use the link below and head to pg 611:
http://public.dhe.ibm.com/software/data/cognos/documentation/docs/en/8.4.0/cp_a.pdf

Cheers,
E

Cognos_World

Thanks again Eric.
You mentioned, "You must must configure OS signon to accomplish what you're looking for."
You mean, Single signon..? We don't want single signon for security reasons currently.

The Analyst document says:
Run a Batch Job (-b)
Use this command to run a batch utility job.
Syntax
CepBatch -b -1 JobName[-4Namespace][-5DefaultResponstText]

And I tried these approaches:
C:\CP_path\bin\CepBatch.exe -b -1 "Sales Batch" -4 "MyNamespace"
C:\CP_path\bin\CepBatch.exe -b -1 "Sales Batch" -4 "MyNamespace"
C:\CP_path\bin\CepBatch.exe -b -1 "Sales Batch" [-4 MyNamespace]
C:\CP_path\bin\CepBatch.exe -b -1 "Sales Batch" [-4MyNamespace]

None of them worked.
What am I missing?




ericlfg

I do mean single signon, yes.

Based on my experience of the batch utility from within Analyst.  All you should have to do is run the batch tool inside analyst and this will create a statement for you.  You can then paste that into a .bat or .cmd file and have this executed against windows scheduler if desired. 

Using a sample application I used the great outdoors analyst library and the Import_all macro.  I did not specify a namespace (no need if there is only one namespace).  The output of the utility is below:

C:\PROGRA~2\ibm\cognos\c10\bin\CepBatch.exe -b -1 "great outdoors analyst-Import_All"

If you need a little more help, just type cepbatch.exe from the command line in the ..\bin directory and it will come up with the help text.

Cognos_World

Thanks Eric.
Maybe I have to live with the sign on prompt as we don't have Single Sign on.

Thank you!

ericlfg


kbrauer

You could also create a macro in CAC that runs the Analyst macro, Publish this to Cognos Connection, create and schedule a job for the Contributor macro in Cognos Connection.