Step 1: Customize the Batch Renaming Script

The reports generated by the Cognos scheduler are given cryptic names.

For example, Approver Settings could potentially be generated as a file named 397_1163638261400.pdf. For each PDF file, the Cognos server also generates a descriptor file in XML format. This file contains the mapping of the generated PDF file name to the report's original name on the Cognos Server.

Note: When the Cognos scheduler generates a report, it saves this PDF file to a "Work" subfolder at the output location you will specify in Step 2.

Make sure to create these folders before you run your job.

Deltek provides a script which, when run, takes the mapping information from the XML file to rename the PDF files to their original report names. This script then also appends the date and time of the report generation to the end of the file name. There is then an option to delete these descriptor files upon completion of the renaming process.

To customize the batch renaming script for your firm, you must edit the renameFiles.bat file, as necessary. The areas to edit are in italics in the following sample.

Use the instructions provided in the batch file to determine the appropriate settings for your installation.

When you are finished, save the renameFiles.bat file. Make sure that the renameFiles.bat, renameFiles.java, and renameFiles.class files are saved to the desired output location.

Note: Exclude special characters (> < " ' & + / ? % # , . : ; = [ ]) from the path and report names. The renaming script will not run if special characters exist in them.
@echo off
REM
REM	Please update the following information before executing the program:

REM COGNOS_HOME:		(Your Cognos install directory) 

set COGNOS_HOME=C:\Program Files\ibm\cognos\analytics

REM JAVA_HOME:		Combining Cognos_Home with this location
Rem				should result in a folder location where
REM				“bin” folder can be found. Make sure there
Rem				is a java.exe inside the “bin” folder.

set JAVA_HOME=%COGNOS_HOME%\bin\jre6

set PATH=%JAVA_HOME&\bin;%PATH%
REM CMOUTPUT_LOCATION:		Location where your CRN server will
REM				save files. This is the directory
REM				where the files “renameFiles.bat”,
REM				“renameFiles.class” and
REM				“renameFiles.java” should exist.

set CMOUTPUT_LOCATION=C:\STOCK_STATUS_ARCHIVES

REM WORK_LOCATION	Location where all files will be moved
REM				before renaming them. By default, this
REM				is the ‘Work’ subfolder of the
REM				CM_OUTPUT_LOCATION. You can use
REM				alternate code below for specifying another
REM				location altogether. Just remember to “REM”
REM				the line of code not in use.

set WORK_LOCATION=%CMOUTPUT_LOCATION%\WORK
REM				set WORK_LOCATION=C:\test

REM				Call the java program to rename the output file
REM				-cp options specifies the classpath information ie location of
REM				renameFiles.class. The files (%1 and %2) that the server will
REM				pass to the batch file will be renamed

REM				Set the last parameter of the code below to “Y” or “y” for the
REM				program to put files under a subfolder; “N” or “n” otherwise
call "%JAVA_HOME%\bin\java" -cp "%CMOUTPUT_LOCATION%" renameFiles "%WORK_LOCATION%" "%1" "%2" N

REM 				Delete the XML descriptor files
REM 				Remove "REM" from the line below if you want descriptor files
REM 				deleted
REM 				del %WORK_LOCATION%\*.xml