Showing posts with label Script. Show all posts
Showing posts with label Script. Show all posts

Monday, 11 September 2017

Datastage Calling script in Remote Server

Step 1: Setting up UNIX server to automatically login without prompt-ing a password.

1. SSH must be installed in both servers. (primary and remote)
2. User ID for both servers

You can find the Step by Step detail on this Link - Configuring_SSH_on_Linux

Step 2: Creating Datastage job to run script in a remote server

1. Create a new sequencer job
2. Add an Execute Command stage
3. In the Command text value in the ExecCommand tab,

type -

 ssh UserB@ServerB ksh /home/b/test.ksh

This command will execute a script in the remote server.

Like the below page to get update

Friday, 14 July 2017

Utility to Get Last Run Log of DataStage Job

Love the new feature of IBM DataStage to fetch the last run log of any jobs with the help of "dsjob" command.
In older version of DataStage, it is very tedious to get the last run log but from/after v9.1 IBM added an additional feature in dsjob command. Lets see hows this works -

  • To Fetch Last Run Log:
  • To Fetch Second Last Run Log
  • To Fetch Third Last Run Log
  • To Fetch Nth Last Run Log

Like the below page to get update

Saturday, 1 April 2017

Get Over Running DataStage Job Details #iLoveScripting

With the script below, we will get a list of jobs which are taking more time to complete than last run time. By some tweaks, we can use this script to monitor any kind of process.

Like the below page to get update

Thursday, 9 March 2017

Perl Script to get content difference of a file #iLoveScripting

This Perl script will help you to get the content difference of a file available in two directories.

Usage: filename dir1 dir2

Working: Script will pick the filename from argument and start comparing its content and print the
difference. Here assumption is the same file is available in two directories.
But we can alter this script to take two file name and one directory or based on our need.

View or Download :

Like the below page to get update

Sunday, 5 March 2017

How to get DataStage Project Settings

DSListProjectSettings.bat is used to report all available settings of existing projects.


The DSListProjectSettings batch file reports all available project settings and environment variable names and values to standard output. The first section shows available DataStage project properties and their settings. The second section shows environment variable names and values. When run successfully, each section will report a status code of zero.


Like the below page to get update

Tuesday, 21 February 2017

PDF Split & Merge with Perl

Sharing two utility scripts (Perl), which can be used for extracting only few pages from a PDF file and also for combining different pdf files into a single pdf files. There might be lot of situation where in, we might require only few pages from a big PDF files. So instead of storing / carrying such a big PDF files, we could extract the page or pages which we require from the original big PDF files. Also we could combine different pdf files into a single pdf file using the second script. As an example, if we have extracted pages 10-15 and pages 100-120 from a big pdf file using the and
we can combine these two pdf files (i.e. pdf which contains pages 10-15 and pdf which contains
pages 100-120) into a single pdf file using

NOTE : These two perl scripts uses a perl module called PDF::API2. If this is not present on your system as part of the perl installation, you can download these modules from and install. Please see the installation section for more details.

These two scripts can be used on windows, unix or linux. Currently tested on Windows with active perl 5.8.8, but it should work on unix and linux as well. For the script to work on unix and linux, please change the variable called "path_separator" to "/" instead of "\\". This variable can be seen at the starting of the script. can be used both on windows and unix/linux without any modification



     perl -i <input pdf file> -p <page or page range which needs to be extracted>

        -i : Please give the full path to the input PDF file
        -p : Page Number or Page range which needs to be extracted from the input PDF

        example : To extract pages 3 to 5, execute

           perl -i /tmp/abc.pdf -p 3-5

        example : To extract only page 3, execute

        perl -i /tmp/abc.pdf -p 3

Executing with -h option will display the usage onto the screen

Example : perl ./ -h


perl <output pdf file with full path> <input pdf file 1> <input pdf file 2> etc

Execute the script with all the pdf file which needs to be merged.
Script will merge in the same order which is given in the input

i.e. If you execute like /tmp/out.pdf /tmp/abc.pdf /tmp/xyz.pdf

then pages from xyz.pdf will be after pages from abc.pdf

Executing with -h option will display the usage onto the screen

Example : ./ -h



Like the below page to get update

Thursday, 9 February 2017

get Queue Depths #iLoveScripting

Wednesday, 7 December 2016

Import the jobs from DS windows client #iLoveScripting

As we have discussed a script which can export the datastage jobs from your client system ( likewise we can write another one to import the jobs. Let's see how -

DsImportJobsClient.bat :

This Script read all the *.dsx job name from the specified Directory and Sub-Directory and import to the Specified project. It can also build (Only BUILD) the existing package created on Information Server Manager and send it to the specified location on client machine.

To use the build feature you need to make sure the package has been created with all the needed jobs, saved and closed. Only update to the selected job will be taken care automatically. To add/delete a job, you need to do manually.

Modify the and ImportJobList.txt file and Go the .bat dir and then execute the importAndBuild.bat. :

ImportJobList.txt :

DsImportJobsClient.bat :

Like the below page to get update

Monday, 21 November 2016

Reading DSParam - datastage parameter file

I am sharing a utility which can help you to read DSParam file which holds all the environmental datastage parameters.

Utility to view contents of DSParams file. Useful when trying to see what all the customer has set at the project level.

$ cat DSParams | ./ | more
$ cat DSParams | ./ > outputfile

1. copy script text below to a file ( on a UNIX system
2. Set execute permissions on this file. chmod 777
3. Usually perl is in /usr/bin/perl but you might have to adjust this path if neccessary. (hint "which perl" should tell you which one to use)
4. cat the DSParams file from the project you are concerned with and redirect the output to this script. You may have to put the Fully Qualified Path for this file.
5. capture the output to screen or file. File may be useful to have the customer send the info to you in email.

Like the below page to get update

Sunday, 6 November 2016

Export the jobs from DS windows client

Datastage jobs Export/Import are occasional activity (Deployment time :-)) for a developer But it becomes very tedious if the job list are long or it's daily routine to export or import jobs.

So I have written a batch script (windows script) which we can execute from the Client Machine (where datastage clients are installed) and automate this process.

DSjobExportClient.bat :
Export Script read the job name from the file (ExportJobList.txt) and exports the jobName.dsx from the project to the export base location and maintain the folder structure specified in the ExportJobList.txt file. File "ExportJobList.txt" and “” should be updated before running the export script.

Copy the above file on any location of your DS windows client machine and update the "ExportJobList.txt" and “” files.
-    ExportJobList.txt
-    ExportJobs.bat :

ExportJobList.txt :

DsExportJobsClient.bat :

Like the below page to get update

Monday, 12 September 2016

Python Points #15 - Exceptions

Tuesday, 31 May 2016

Python Points #13 - Comprehensions

Sunday, 7 February 2016

Python Points #10b - Reading Files

Wednesday, 3 February 2016

Python Points #9 - Tuples

Tuesday, 12 January 2016

Python Points #6 - Strings