Export DataStage jobs from Command line without executables
Moderators: chulett, rschirm, roy
Export DataStage jobs from Command line without executables
Hi,
Is it possible to export just the job design without executables from Command line using dsexport or dscmdexport command. This option is present in Designer , but whats the corresponding way to achieve the same through command line
If its possible, please let me know the correct way to do so
Thanks in advance,
Punit
Is it possible to export just the job design without executables from Command line using dsexport or dscmdexport command. This option is present in Designer , but whats the corresponding way to achieve the same through command line
If its possible, please let me know the correct way to do so
Thanks in advance,
Punit
-
- Participant
- Posts: 57
- Joined: Wed Oct 21, 2009 4:46 am
- Location: India
Strange!!! whatever we can do with mouse ( running, exporting, compiling, etc ) should be achievable through the command prompt as well.
Any workaround to achieve this will be appreciated !!!
Literature says that istool commands are executed on CLI console!! where in DS I can execute these commands!!
Is it possible to achieve the above objective through istool command
Any workaround to achieve this will be appreciated !!!
Literature says that istool commands are executed on CLI console!! where in DS I can execute these commands!!
Is it possible to achieve the above objective through istool command
I am looking for a client based solution, but it would be beneficial if you let me know both the options
dsexport is a programme present in the installation directory so we were able to execute it.
What programme is executed for istool , since i am unable to find any programme like istool.exe
I am automating this command to take regular backup of my project through Windows Scheduler
dsexport is a programme present in the installation directory so we were able to execute it.
What programme is executed for istool , since i am unable to find any programme like istool.exe
I am automating this command to take regular backup of my project through Windows Scheduler
I'd be surprised if that part makes them "huge" or adds a great deal of time to the process but who knows. If you really need them gone, you might want to consider a post process (script, Perl, ds job, etc) to remove that section from the export before you version it.
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
There is a script DataStageExport1PerJob.bat to export one job at a time without the executables. It does dsjob -ljobs to get a list of jobs to export. It may have an issue with batch jobs because the filename is the job name. I do not know how fast it is. I do not know if it is a good replacement because it does not export routines and everything it takes to restore a project. Maybe a combination of this everyday and a full export once a week may solve your problem.
If this script is not out there then let me know.
If this script is not out there then let me know.
Mamu Kim
Here it is:
Code: Select all
@echo off
:: -----------------------------------------------------------------
:: DataStageExport1PerJob.bat
:: -----------------------------------------------------------------
:: This batch script is used to Export all the DSX files in a Directory
:: must be run from a DataStage client machine and the parameters below should be
:: modified to fit your environment. Use of parameters was avoided to simplify Export
:: allow the command to be customized to a particular environment.
::
:: Based on design by Manoli Krinos
:: Nov 22, 2004 - Kim Duke - Created
:: -----------------------------------------------------------------
:: Required Components:
:: dsExport.exe (Windows Version)
:: -----------------------------------------------------------------
:: Host is server name
:: User is username to use to attach to DataStage
:: Password is password to use to attach to DataStage
:: ExportDir is the directory above the backed up project
:: ProjectDir is the directory below ExportDir
:: DsExportCmd is directory of the Export command on client
:: -----------------------------------------------------------------
:: Ensure that everything that are set here are not permanent.
:: -----------------------------------------------------------------
SETLOCAL
:: -----------------------------------------------------------------
:: Test to ensure that command line is provided semi-correctly.
:: -----------------------------------------------------------------
IF "%1"=="" GOTO Syntax
IF "%2"=="" GOTO Syntax
IF "%3"=="" GOTO Syntax
IF "%4"=="" GOTO Syntax
SET Host=%1
SET Project=%2
SET User=%3
SET Password=%4
:: -----------------------------------------------------------------
:: Get the current Date
:: -----------------------------------------------------------------
FOR /f "tokens=2-4 delims=/ " %%a in ('DATE/T') do SET DsxDate=%%c%%a%%b
:: -----------------------------------------------------------------
:: Get the current Time
:: -----------------------------------------------------------------
FOR /f "tokens=1* delims=:" %%a in ('ECHO.^|TIME^|FINDSTR "[0-9]"') do (SET DsxTime=%%b)
:: -----------------------------------------------------------------
:: Set delimeters so that current time can be broken down into components
:: then execute FOR loop to parse the DsxTime variable into Hr/Min/Sec/Hun.
:: -----------------------------------------------------------------
SET delim1=%DsxTime:~3,1%
SET delim2=%DsxTime:~9,1%
FOR /f "tokens=1-4 delims=%delim1%%delim2% " %%a in ('echo %DsxTime%') do (
set DsxHr=%%a
set DsxMin=%%b
set DsxSec=%%c
set DsxHun=%%d
)
:: -----------------------------------------------------------------
:: If provided directory is missing an ending \, append it.
:: Validate %ProjectDir%'s existance.
:: -----------------------------------------------------------------
if exist %ProjectDir%\ set ProjectDir=%ProjectDir%\
if NOT exist %ProjectDir% GOTO BadMain
:: -----------------------------------------------------------------
:: Set the log file name to improve readability of code.
:: -----------------------------------------------------------------
SET LogFileName=%ProjectDir%\DataStageExport_bat_%DsxDate%_%DsxHr%_%DsxMin%_%DsxSec%.log
:: -----------------------------------------------------------------
:: Main
:: -----------------------------------------------------------------
SET ArchiveDir=Archive_%DsxDate%_%DsxHr%_%DsxMin%_%DsxSec%
cd %ProjectDir%
mkdir %ArchiveDir%
MOVE *.dsx %ArchiveDir%
MOVE *.log %ArchiveDir%
:: -----------------------------------------------------------------
:: Pull job list
:: -----------------------------------------------------------------
%DsJobCmd% -server %Host% -user %User% -password %Password% -ljobs %Project% > %JobList%
IF NOT %ERRORLEVEL%==0 GOTO BadParam
:: -----------------------------------------------------------------
:: Announce to log of this program's run.
:: -----------------------------------------------------------------
ECHO. > %LogFileName%
ECHO DataStage Export ran on %DsxDate% %DsxHr%:%DsxMin%:%DsxSec% with the following parameters >> %LogFileName%
ECHO Host=%Host% >> %LogFileName%
ECHO User=%user% >> %LogFileName%
ECHO ExportDir=%ExportDir% >> %LogFileName%
ECHO ProjectDir=%ProjectDir% >> %LogFileName%
ECHO DsExportCmd=%DsExportCmd% >> %LogFileName%
ECHO JobList=%JobList% >> %LogFileName%
ECHO. >> %LogFileName%
for /F "tokens=1" %%i in (%JobList%) do (call :s_DoExport %%i)
GOTO EXITPT
:: -----------------------------------------------------------------
:: dsExport.exe /H=hostname /U=username /P=password /O=omitflag /NUA project|/ALL|/ASK dsx_pathname1 dsx_pathname2
:: -----------------------------------------------------------------
:s_DoExport
set JobName=%1
set FileName=%JobName::=%
ECHO Exporting %JobName% to Project: %Project% on Host: %Host%
echo "%DsExportCmd% /H=%Host% /U=%User% /P=%Password% /JOB=%JobName% %Project% %FileName%.dsx" >> %LogFileName%
%DsExportCmd% /H=%Host% /U=%User% /P=%Password% /JOB=%JobName% %Project% %FileName%.dsx >> %LogFileName%
IF NOT %ERRORLEVEL%==0 GOTO ProjFail
ECHO. >> %LogFileName%
ECHO *** Completed Export for Project: %Project% on Host: %Host% >> %LogFileName%
ECHO from File: %ProjectDir%\%FileName% >> %LogFileName%
ECHO. >> %LogFileName%
GOTO ENDPOINT
:: -----------------------------------------------------------------
:: Usage
:: -----------------------------------------------------------------
:Syntax
echo.
echo DataStage Automated Export Routine
echo.
echo Based on design by Manoli Krinos
echo.
echo Modified by Kim Duke
echo.
echo Usage: DataStageExport Server Project Username Password
echo.
echo Server - Hostname
echo Project
echo Username - Username to use on Server.
echo Password - Associated password for Username on Server.
echo.
GOTO ENDPOINT
:: -----------------------------------------------------------------
:: Report that directory is non-existant.
:: -----------------------------------------------------------------
:BadMain
echo.
echo Bad/Non-existing directory: %ExportDir%
echo.
echo Please ensure that you have permission to access/create directories
echo and files. Also ensure that directory listed exists.
echo.
echo. >> %LogFileName%
echo Bad/Non-existing directory: %ExportDir% >> %LogFileName%
echo. >> %LogFileName%
GOTO EXITPT
:: -----------------------------------------------------------------
:: ERROR: a file failed to be Exported.
:: -----------------------------------------------------------------
:ProjFail
ECHO.
ECHO *** ERROR: Failed to Export Project: %Project% on Host: %Host%
ECHO.
ECHO Please ensure that nobody else is accessing this server while you
ECHO are running this Export script.
ECHO.
ECHO. >> %LogFileName%
ECHO *** ERROR: Failed to Export File: %ProjectDir%\%FileName% Project: %Project% on Host: %Host% >> %LogFileName%
ECHO. >> %LogFileName%
GOTO ENDPOINT
:: -----------------------------------------------------------------
:EXITPT
ECHO. >> %LogFileName%
:: -----------------------------------------------------------------
:ENDPOINT
:: Kim del %JobList% > NUL 2> NUL
ENDLOCAL
Mamu Kim