Renaming lots of DataStage jobs

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
shawn_ramsey
Participant
Posts: 145
Joined: Fri May 02, 2003 9:59 am
Location: Seattle, Washington. USA

Renaming lots of DataStage jobs

Post by shawn_ramsey »

All,

We are going through an effort to clean up our DataStage environment before undertaking our next big development push and one of our issues is that everyone interpreted our naming standards differently :o. We would like to go through and rename these jobs to follow our naming standards. We have created a spreadsheet with the old and new names and would like to script out a method to do a massive rename.

My current idea is to:
1) Dump the project to a DSX file.
2) Run a Perl script to rename the jobs.
3) Import the new DSX file.
4) Recompile all the jobs

Is there any other approach that would be better?
Shawn Ramsey

"It is a mistake to think you can solve any major problems just with potatoes."
-- Douglas Adams
kcbland
Participant
Posts: 5208
Joined: Wed Jan 15, 2003 8:56 am
Location: Lutz, FL
Contact:

Post by kcbland »

What about your job control? Any issues there? Otherwise, your plan seems reasonable.
Kenneth Bland

Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle
datastage
Participant
Posts: 229
Joined: Wed Oct 23, 2002 10:10 am
Location: Omaha

Re: Renaming lots of DataStage jobs

Post by datastage »

shawn_ramsey wrote:All,

We are going through an effort to clean up our DataStage environment before undertaking our next big development push and one of our issues is that everyone interpreted our naming standards differently :o. We would like to go through and rename these jobs to follow our naming standards. We have created a spreadsheet with the old and new names and would like to script out a method to do a massive rename.

My current idea is to:
1) Dump the project to a DSX file.
2) Run a Perl script to rename the jobs.
3) Import the new DSX file.
4) Recompile all the jobs

Is there any other approach that would be better?

That's not a bad method. I'm not sure how many jobs you are dealing with or if you have reusable Perl code for this task, but as painful as it sounds, a manual process of find/replace in wordpad (helps to have a NT workstation with a good amount of RAM) or a similar manual process on the UNIX side should work with little room for error.

Don't forget that renaming jobs affects any job control jobs and sequencers calling jobs with the old name. This also might be a good time to import the new dsx you create to a new project, at a mininum for testing, but possibly as a cleanup method as over time there ends up being many unused hashed file and table definitions in the repository that never go away
kduke
Charter Member
Charter Member
Posts: 5227
Joined: Thu May 29, 2003 9:47 am
Location: Dallas, TX
Contact:

Post by kduke »

No way. I think this is very dangerous. There is a product called DsToolBox on http://www.teknion.net designed to do exactly this. I have never used it but I think it is a lot safer way to change all of these jobs.
Mamu Kim
kduke
Charter Member
Charter Member
Posts: 5227
Joined: Thu May 29, 2003 9:47 am
Location: Dallas, TX
Contact:

Post by kduke »

Also if your parameters are inconsistant then I would get Parameter Manager. It can quickly standardize your parameters. These products are not expensive and could easily pay for themselves on this project.
Mamu Kim
neena
Participant
Posts: 90
Joined: Mon Mar 31, 2003 4:32 pm

Re: Renaming lots of DataStage jobs

Post by neena »

Hi Ram,

This depends how your project is designed.
The main issue somes with the Sequencers.
You need to build/edit those sequencers again.
We never tried this before ( renaing with script on export file)..
I suggest to go manually and replace the names with convensional names.

Tnks
Neena
shawn_ramsey wrote:All,

We are going through an effort to clean up our DataStage environment before undertaking our next big development push and one of our issues is that everyone interpreted our naming standards differently :o. We would like to go through and rename these jobs to follow our naming standards. We have created a spreadsheet with the old and new names and would like to script out a method to do a massive rename.

My current idea is to:
1) Dump the project to a DSX file.
2) Run a Perl script to rename the jobs.
3) Import the new DSX file.
4) Recompile all the jobs

Is there any other approach that would be better?
shawn_ramsey
Participant
Posts: 145
Joined: Fri May 02, 2003 9:59 am
Location: Seattle, Washington. USA

Re: Renaming lots of DataStage jobs

Post by shawn_ramsey »

neena wrote:Hi Ram,

This depends how your project is designed.
The main issue somes with the Sequencers.
You need to build/edit those sequencers again.
We never tried this before ( renaing with script on export file)..
I suggest to go manually and replace the names with convensional names.

Tnks
Neena
I have just gone through a similar process with a bunch of Perl scripts and it worked fairly well so I feel comfortable with the code for the global search and destroy. In addition we are using a table driven automation process for the jobs themselves so the issue with sequencers in moot.

I will take a look at the tools mentioned by others but I think I will test this approach. Maybe even in production.

In case my boss is reading this, I was only joking about the production thing. :D
Shawn Ramsey

"It is a mistake to think you can solve any major problems just with potatoes."
-- Douglas Adams
clshore
Charter Member
Charter Member
Posts: 115
Joined: Tue Oct 21, 2003 11:45 am

Post by clshore »

I've successfully done things similar to this with Perl scripts. But if you are simply doing a global find'n'replace, sed or awk would probably work as well.
Having said that, there's always the risk with global s'n'r that your find pattern may have an undesired match. You should make sure that the pattern is as specific and restricted as possible.
You could export the jobs as XML. There are some nice Perl libraries that work with XML documents, that would allow you to search and modify specific job elements in the XML by name. Of course, you have to determine what elements you want to change.
A changed element log is a very good thing to have.
What are you using for DS version control?
You'd want to do a regression test after any changes anyway, no matter what tool you use.

Carter Shore
mhester
Participant
Posts: 622
Joined: Tue Mar 04, 2003 5:26 am
Location: Phoenix, AZ
Contact:

Post by mhester »

Shawn,

Your solution is solid if you limit your search and destroy to jobs. In either the xml or dsx the identifier and name are what you need to be concerned with. The name of the job is not in any other tag and if it is, it is probably a comment. The name of the "job" is always in the ROOT record of DS_JOBOBJECTS.

I have a toolkit with BASIC, Perl, C and DS jobs that do exactly what you desire and have never had an issue. It only becomes a bit more complex when you throw other types of objects in the mix.

Example (xml) -

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<DSExport>
   <Header CharacterSet="ENGLISH" ExportingTool="Ascential DataStage Export" ToolVersion="4" ServerName="vbasabadev" ToolInstanceID="vn_conv_devl" Date="2003-12-16" Time="14.26.47"/>
   <[i][b]Job Identifier="RowSetInsertUpdate[/b][/i]" DateModified="2003-12-16" TimeModified="13.57.12">
      <Record Identifier="ROOT" Type="JobDefn" Readonly="0">
         <Property [i][b]Name="Name">RowSetInsertUpdate[/b][/i]</Property>
Example (dsx) -

Code: Select all

BEGIN DSJOB
   Identifier "RowSetInsertUpdate"
   DateModified "2003-12-16"
   TimeModified "13.57.12"
   BEGIN DSRECORD
      Identifier "ROOT"
      OLEType "CJobDefn"
      Readonly "0"
      Name "RowSetInsertUpdate"
Regards,

Michael Hester
Post Reply