Import Jobs from Command line

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
imbos123
Charter Member
Charter Member
Posts: 18
Joined: Mon Jul 24, 2006 1:43 pm

Import Jobs from Command line

Post by imbos123 »

Hi,

I have a dsx which contains one Job design exported from Datastage Manager. My aim is to import this job design from command line and not through Datastage manager. I checked the documentation and I was able to import the Job executables rather than Job designs. So when I import job executables I am not able to see them in designer as I do not have designer details.

Please let me know if I can import job designs from command line.
Thanks
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

What version of DataStage precisely? The answer is probably yes, but I'll not commit to that without knowing your version.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
kduke
Charter Member
Charter Member
Posts: 5227
Joined: Thu May 29, 2003 9:47 am
Location: Dallas, TX
Contact:

Post by kduke »

I will post a couple of scripts soon which are based on the backup batch file DataStageBackup.bat. My current customer does not use Version Control. So I modified that script to load all DSX files in a directory. The Directory is the project name. It uses my current directory structure so you need to modify it to use something other than.

C:\DataStage\KimD\Scripts
C:\DataStage\KimD\Backups\MyProject

So you will need a directory for each project.

We have a migration document which gives the list of jobs and routines to move. So I can also export all jobs in a text file called JobList.txt.

C:\DataStage\KimD\Backups\MyProject\JobList.txt

So I should post DataStageImporter.bat and DataStageExporter.bat this weekend. Hopefully someone will need these.

We should add the check in to CVS soon. Let you know when we automate that.

By the way thanks to these guys for the original script:

Manoli Krinos
M Ruland
T.J. Griesenbrock
Mamu Kim
imbos123
Charter Member
Charter Member
Posts: 18
Joined: Mon Jul 24, 2006 1:43 pm

Post by imbos123 »

Hi Ray,Duke,

We are using Enterprise Edition of 7.5.1.A.
Actually, I have to give solution to my client by end of day today or we have to find some other solution.
My client doesn't use version control of Datastage. They use PVCS to store the DSX and wish to automate the process of taking the latest version of DSX and move them to QA/Prod using this import script. If you can give me some clue how to do it I can at least tell them the time required for completion of this automated process.

Thanks for your help.
Thanks
kduke
Charter Member
Charter Member
Posts: 5227
Joined: Thu May 29, 2003 9:47 am
Location: Dallas, TX
Contact:

Post by kduke »

I am sorry. I forgot to copy these scripts to my thumb drive. Will do it tomorrow.

You need to start with DataStageBackup.bat. Next you need to modify to dsimport.exe on the DataStageImporter.bat and dsexport.exe. (I think) You need to cd into the correct directory. Next you a list of jobs or DSX files.

DIR *.dsx > DsxList.txt

or

edit JobList.txt

Next you need to change the for loop to use either DsxList.txt or JobList.txt. Next execute the command above with either the dsx file or /JOB=%%i. So the code looks like:

Code: Select all

    for /F "tokens=1" %%i in (%ProjectList%) do (

        ECHO Backing up Project %%i

        %DSExportCmd% /H=%Host% /U=%User% /P=%Password% %%i %BackupDir%%DsxDate%\%Host%_%%i.dsx >> %LogFileName%
        IF NOT %ERRORLEVEL%==0 GOTO ProjFail

        ECHO. >> %LogFileName%
        ECHO *** Completed Export for Project: %%i on Host: %Host% >> %LogFileName%
        ECHO     to File: %BackupDir%%DsxDate%\%Host%-%%i.dsx >> %LogFileName%
        ECHO. >> %LogFileName%
    )
Changes to

Code: Select all

    for /F "tokens=1" %%i in (%JobList%) do (

        ECHO Backing up Project %%i

        %DSExportCmd% /H=%Host% /U=%User% /P=%Password% /JOB=%%i %Project% %%i.dsx >> %LogFileName%
        IF NOT %ERRORLEVEL%==0 GOTO ProjFail

        ECHO. >> %LogFileName%
        ECHO *** Completed Export for Project: %%i on Host: %Host% >> %LogFileName%
        ECHO     to File: %BackupDir%%DsxDate%\%Host%-%%i.dsx >> %LogFileName%
        ECHO. >> %LogFileName%
    )
Mamu Kim
kduke
Charter Member
Charter Member
Posts: 5227
Joined: Thu May 29, 2003 9:47 am
Location: Dallas, TX
Contact:

Post by kduke »

After you export the jobs you need to check in to PVCS. You need to post the syntax of the command line check in.
Mamu Kim
imbos123
Charter Member
Charter Member
Posts: 18
Joined: Mon Jul 24, 2006 1:43 pm

Post by imbos123 »

Hi Kim,

Below is process we are trying to follow for moving the jobs from Development to QA
1) Developer will Export the jobs using Datastage Manager into .dsx format
2) Developer will Check In the dsx into PVCS
3) QA will get the latest version of dsx from PVCS and move them into QA
This process of moving the jobs from PVCS to QA is to be automated and it should be flexible to import only one job or multiple jobs in a loop. This is because we may fix one odd job and then move into QA for testing.
We need actual Job designs to move to QA

I studied your DataStageBackup.bat script, it does whole backup of a project. It would be a great help for us to take the backups.

Syntax for Getting the dsx from PVCS is as below
get -r file_name ( this will get the specific revison of the file)

To put the files into PVCS the command is
put -f file_name ( this will check in the file even if it is not changed)

I will wait for you to post dsimport.exe on the DataStageImporter.bat and dsexport.exe
Thanks
kduke
Charter Member
Charter Member
Posts: 5227
Joined: Thu May 29, 2003 9:47 am
Location: Dallas, TX
Contact:

Post by kduke »

Mamu Kim
imbos123
Charter Member
Charter Member
Posts: 18
Joined: Mon Jul 24, 2006 1:43 pm

Post by imbos123 »

Hi Kim,

Thank You Very Much for your timely help.
The script is great...
Thanks
kduke
Charter Member
Charter Member
Posts: 5227
Joined: Thu May 29, 2003 9:47 am
Location: Dallas, TX
Contact:

Post by kduke »

Your are welcome. I will add a for more soon.
Mamu Kim
imbos123
Charter Member
Charter Member
Posts: 18
Joined: Mon Jul 24, 2006 1:43 pm

Post by imbos123 »

Hi Kim,

I implemented the import script and working fine when I run it from the DOS prompt.
As mentioned before I am using PVCS mover option to import these jobs by selecting the latest dsx from PVCS.
Now, what is happening is when Datastage tries to import jobs it shows some prompts which has to be clicked yes or no so that the job is imported.
Issue here is when I use ETL Mover option of PVCS, this prompt is not shown to the user as it is triggered from 3rd party tool and becos the user doesn't respond, Datstage waits for response and hangs.
Can you please help me in resloving or suppressing this responses as PVCS doesn't show these prompts becos the script is run in background.
Thanks
kduke
Charter Member
Charter Member
Posts: 5227
Joined: Thu May 29, 2003 9:47 am
Location: Dallas, TX
Contact:

Post by kduke »

Not sure how to get past that. I need to research it.
Mamu Kim
kduke
Charter Member
Charter Member
Posts: 5227
Joined: Thu May 29, 2003 9:47 am
Location: Dallas, TX
Contact:

Post by kduke »

I would try adding this to your command line.

Code: Select all

/O=1
Let me know if it works.
Mamu Kim
imbos123
Charter Member
Charter Member
Posts: 18
Joined: Mon Jul 24, 2006 1:43 pm

Post by imbos123 »

Hi Kim,

It doesnt work. I tried options like -Q, -QUIET
But they also did not work.
Thanks
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

The dsjob command line utility has an -import option in your version of DataStage.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply