You can automate the comparing DataStage jobs across environments or same environments using a diffapicmdline.exe file.
This is provided by IBM and resides in C:\IBM\InformationServer\Clients\Classic directory.
We need to pass the required arguments to diffapicmdline.exe and it will compare the datastage jobs based on our arguments.
Below Script is used to compare the jobs from command line.
@echo off for /F "tokens=* delims=" %%A in (Job_List.csv) do ( start /wait "" diffapicmdline.exe /lhscd "/d=dev.xyz.com:9080 /h=dev.xyz /u=user1 /p=P@SSW@RD IDW %%A" /rhscd "/d=prod.xyz.com:9080 /h=prd.xyz /u=user1 /p=P@SSW@RD IDW %%A" /t job /ot html /ol "C:\COMPARED\%%A.html" echo %%A &amp;gt;&amp;gt; Completed_Jobs.txt )
Save the above content with your details in a .bat file and place the file in C:\IBM\InformationServer\Clients\Classic directory. I name the .bat file as ‘compare.bat’ here.
This script is designed by keeping following points in mind:
- Comparing the jobs across 2 different DataStage servers
- Assuming job names are same in 2 servers
However you can modify the script according to your needs and you can have job names also different to compare them.
Generally, we go for automation when we have many jobs to compare so I will have all the job names in separate file i.e. in Job_List.csv. Here Job_List.csv should have only job names line by line, that means one job name per line.
Sample output of batch script for comparing MyTestJob1 and MyTestJob2:
Remember that script should be invoked from C:\IBM\InformationServer\Clients\Classic directory only. If you invoke this batch script from any other directory you may get an error like “Unhandled Exception: System.ApplicationException: System not set up” error.
Note: “C:\COMPARED” directory won’t be created automatically in C directory, you need to create a folder in C directory and then run the script. If you don’t have a folder with the name COMPARED in C directory, it won’t give any error but you can’t see the output HTML files.
Run the .bat script from command line exactly like below.
The script will run like:
After script is completed you can see HTML files in COMPARED folder and script creates one HTML for each job compare.