This script will export the datastage jobs into individual dsx files as sometimes, we need individual dsx to maintain the code version or syncing it with SVN.
Manually export of each datastage job is quite hectic and boring hence this script :-)
This script requires little bit information from you and set you free for your other chores
Prerequisites for this script -
1. Job List to Export
2. DataStage Client Installation Location
3. DataStage Credential
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
:: ############################################################################################# | |
:: | |
:: Name: dsExport.bat | |
:: Description: This Windows batch script export the datastage job in individual dsx | |
:: | |
:: Author: Atul Singh | |
:: Connect: https://www.linkedin.com/in/atulsinghds | |
:: http://www.datagenx.net | |
:: | |
:: ############################################################################################## | |
@echo off | |
For /f "tokens=1-3 delims=/ " %%a in ('date /t') do (set mydate=%%c-%%b-%%a) | |
For /f "tokens=1-2 delims=/:" %%a in ("%TIME%") do (set mytime=%%a%%b) | |
set mytime=%mytime: =0% | |
echo %mydate%_%mytime% | |
:: ################################################################# | |
:: Parameter Configuration | |
:: Replace <PARAM> to Respective Value | |
:: ################################################################# | |
:: Provide the Code Directory where you want to export | |
Set CodeDir=C:\Users\atusingh\Desktop\code | |
:: Provide the DataStage Project Name | |
Set Project=<PROJECT_NAME> | |
Set LogFileName=Exp_%Project%_%mydate%_%mytime%.log | |
Set ExpFolder=%Project%_%mydate% | |
:: Provide the DataStage Job List | |
Set JobList=dsJobList_%Project% | |
:: Provide the dsexport.exe file location (you will find it where datastage client installed) | |
Set cmdHome=C:\IBM\InformationServer115\Clients\Classic | |
:: Provide the Credentials | |
Set Server=<SERVER> | |
Set Port=<PORT> | |
Set User=<USERNAME> | |
Set Password=<PASSWORD> | |
:: ################################################################# | |
:: Main | |
:: ################################################################# | |
IF NOT EXIST %CodeDir% mkdir %CodeDir% | |
cd %CodeDir% | |
IF NOT EXIST %ExpFolder% mkdir %ExpFolder% | |
echo > %LogFileName% | |
echo ----------------------------------- >> %LogFileName% | |
echo Server: %Server% >> %LogFileName% | |
echo Project: %Project% >> %LogFileName% | |
echo JobList: %JobList% >> %LogFileName% | |
echo ----------------------------------- >> %LogFileName% | |
for /F "tokens=1" %%i in (%JobList%) do ( | |
:: Export design only | |
%cmdHome%\dsexport.exe /D=%Server%:%Port% /H=%Server% /U=%User% /P=%Password% /JOB=%%i /NODEPENDENTS %Project% %CodeDir%\%ExpFolder%\%%i.dsx | |
:: /EXEC - export executables only (Appending mode) | |
%cmdHome%\dsexport.exe /D=%Server%:%Port% /H=%Server% /U=%User% /P=%Password% /JOB=%%i /EXEC /APPEND /NODEPENDENTS %Project% %CodeDir%\%ExpFolder%\%%i.dsx | |
echo Job: %%i exported >> %LogFileName% | |
) | |
:: Zipping and Archiving the Joblist and export LogFile | |
zip %Project%_%mydate%_%mytime% %LogFileName% %JobList% | |
mv %Project%_%mydate%_%mytime%.zip %ExpFolder% | |
pause | |
https://www.facebook.com/datastage4you
https://twitter.com/datagenx
https://plus.google.com/+AtulSingh0/posts
https://datagenx.slack.com/messages/datascience/