1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136
| @Title 通过DataStage客户端工具自动导入导出DataStage作业-dsx文件 @echo off & setlocal enabledelayedexpansion
color 0f ::窗口大小 @mode con lines=50 cols=150 echo. echo Ahthor : heibanbai.com.cn echo Date : 2024-08-08 echo Desc : export datastage jobs to jobname.dsx(one job one job.dsx), import file.dsx into datastage project echo. ::Information of environment set domain=199.188.166.111:9446 set hostname=heibanbai set user=wasadmin set password=wasadmin ::检查当前程序所在目录是否正确 应放在客户端工具所在目录下 dir dscmdimport.exe > nul 2<&1 if "%errorlevel%"=="1" (echo Path is error, please put this program into the path of ~\InformationServer\Clients\Classic... goto exit) dir dsexport.exe > nul 2<&1 if "%errorlevel%"=="1" (echo Path is error, please put this program into the path of ~\InformationServer\Clients\Classic... goto exit) echo -------------------------------------------- echo Import Job need 4 parameters, for example: echo import RUNMDS D:\job.list D:\path echo -------------------------------------------- echo Export Job need 4 parameters, for example: echo export RUNMDS D:\job.list D:\path echo -------------------------------------------- echo. :pinput echo Please intput the rigth parameters (q=exit) : set /p params= if "%params%"=="q" goto exit goto checkpara echo. :checkpara set num=0 for %%i in (%params%) do ( set /a num+=1 set param!num!=%%~i ) if not %num%==4 goto pinput set type=%param1% set project=%param2% set joblist=%param3% set dsxpath=%param4% set ymd=%date:~0,4%%date:~5,2%%date:~8,2% set ymd_t=%ymd%_%time:~0,2%%time:~3,2%%time:~6,2% set ymd_t=%ymd_t: =0% if "%type%"=="import" goto doimport if "%type%"=="export" goto doexport goto pinput :doimport if not exist "%dsxpath%" ( echo dsxpath %dsxpath% not exist... goto pinput ) echo ###################################################################################### echo ######################################################################################>%dsxpath%\%ymd_t%.log echo Begin import the dsx file in %dsxpath% into project %project%, please wait...... echo Begin import the dsx file in %dsxpath% into project %project%, please wait......>>%dsxpath%\%ymd_t%.log echo ###################################################################################### echo ######################################################################################>>%dsxpath%\%ymd_t%.log set num=0 for /f "delims=" %%i in (%joblist%) do ( set /a num+=1 if exist "%dsxpath%\%%i.dsx" ( dscmdimport /D=%domain% /H=%hostname% /U=%user% /P=%password% /NUA %project% %dsxpath%\%%i.dsx /V>%dsxpath%\%ymd_t%_import.tmp type %dsxpath%\%ymd_t%_import.tmp type %dsxpath%\%ymd_t%_import.tmp>>%dsxpath%\%ymd_t%.log echo DSX !num! : %dsxpath%\%%i.dsx is imported ok... echo DSX !num! : %dsxpath%\%%i.dsx is imported ok...>>%dsxpath%\%ymd_t%.log dscc /d %domain% /h %hostname% /u %user% /p %password% %project% /J %%i>%dsxpath%\%ymd_t%_import.tmp type %dsxpath%\%ymd_t%_import.tmp type %dsxpath%\%ymd_t%_import.tmp>>%dsxpath%\%ymd_t%.log echo JOB !num! : %%i is compiled ok... echo JOB !num! : %%i is compiled ok...>>%dsxpath%\%ymd_t%.log echo ************************ echo ************************>>%dsxpath%\%ymd_t%.log ) else ( echo DSX !num! : %dsxpath%\%%i.dsx not exist... echo DSX !num! : %dsxpath%\%%i.dsx not exist...>>%dsxpath%\%ymd_t%.log echo DSX !num! : %dsxpath%\%%i.dsx not exist...>>%dsxpath%\%ymd_t%.err echo ************************ echo ************************>>%dsxpath%\%ymd_t%.log ) ) echo All the job has been imported, you can check log [ %dsxpath%\%ymd_t%.log %dsxpath%\%ymd_t%.err]... echo All the job has been imported, you can check log [ %dsxpath%\%ymd_t%.log %dsxpath%\%ymd_t%.err ]...>>%dsxpath%\%ymd_t%.log echo. goto pinput :doexport if not exist %dsxpath% md %dsxpath% echo ###################################################################################### echo ######################################################################################>>%dsxpath%\%ymd_t%.log echo Begin export the Jobs in %project% %joblist% to dir %dsxpath%, please wait...... echo Begin export the Jobs in %project% %joblist% to dir %dsxpath%, please wait......>>%dsxpath%\%ymd_t%.log echo ###################################################################################### echo ######################################################################################>>%dsxpath%\%ymd_t%.log set num=0 for /f "delims=" %%J in (%joblist%) do ( dsexport.exe /D=%domain% /H=%hostname% /U=%user% /P=%password% %project% /Job=%%J /NODEPENDENTS %dsxpath%\%%J.dsx set /a num+=1 echo JOB !num! : %%J is ok... echo JOB !num! : %%J is ok...>>%dsxpath%\%ymd_t%.log ) echo All the job has been exported... echo All the job has been exported...>>%dsxpath%\%ymd_t%.log echo . goto pinput :exit echo Press any key to exit...... pause>nul exit
|