COMPARE DATASTAGE ETL JOBS USING AUTOMATED SCRIPT

COMPARE-DATASTAGE-ETL-JOBS-USING-AUTOMATED-SCRIPT

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 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 >> Completed_Jobs.txt
)

compare-script-looks-like

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.

list-of-datastage-jobs-those-needs-to-be-compared

Sample output of batch script for comparing MyTestJob1 and MyTestJob2:

Validating syntax of /lhscd.
Validating syntax of /rhscd.
Preparing Items MyTestJob1 and MyTestJob2
……..
Diffing Items
Writing Output to ‘C:\compare_output.html’
Finished

compare-datastage-jobs-script-in-action

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.

trigger-datastage-jobs-compare-script

The script will run like:

compare-script-output-while-running

After script is completed you can see HTML files in COMPARED folder and script creates one HTML for each job compare.

final-output-html-file-with-the-compare-result

Comments

comments

Leave a Reply