Step 2: Customize the Batch Renaming Script
The reports generated by 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.
Make sure to create these folders before running 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 (located at C:\Program Files (x86)\Deltek\CostpointEnterpriseReporting\CER723\SOX\Scripts), as necessary. The areas to edit are in italics in the following sample.
When you are through, save the renameFiles.bat file. Ensure that the renameFiles.bat, renameFiles.java, and renameFiles.class files are saved to the desired output location.
Examples of special characters are: > < “ ‘ & + / ? % # + , . : ; = [ ]
@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%\jre
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 “renameFile.class” and
REM “renameFiles.java” should exist.
Set CMOUTPUT_LOCATION=C:\Output
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 the
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 option specifies the classpath information i.e. location of renameFiles.class
REM The files (%1 and %2) that the server will pass to the batch file will be renamed
REM Set the last parameter of the code below to “Y” or “y” for the program to put files
REM 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 deleted
REM Deltek %WORK_LOCATION%\*.xml