Add new parameter to all 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
Simba
Participant
Posts: 22
Joined: Wed Dec 03, 2003 6:12 pm

Add new parameter to all jobs

Post by Simba »

I want to add new parameter to all jobs like owner_stg. Also, I want to modify user defined query with #owner_stg# and table name in the target. Please advise if there any easy way to do this. I have around 500 jobs in a folder.

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

Post by kduke »

Someone asked a similar question last week on how to change the schema name on a fully qualified table name on all their jobs. Do a search. There were several answers all have issues in that once you start playing around with DS_JOBOBJECTS you could have serious problems.
Mamu Kim
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Get Parameter Manager for DataStage.
You can find out about it from here
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
vmcburney
Participant
Posts: 3593
Joined: Thu Jan 23, 2003 5:25 pm
Location: Australia, Melbourne
Contact:

Post by vmcburney »

There is a way to do it by exporting the folder to a sequential file and adding the parameter using search and replace commands in MS Word.

In an export file find a parameter that is in all jobs, it looks something like this:

Code: Select all

      BEGIN DSSUBRECORD
         Name "CODE"
         Prompt "Enter a code"
         Default "MONARO"
         ParamType "0"
      END DSSUBRECORD
In MS Word search and replace part of that text string to add a marker to each parameter section to indicate where the new parameter will go. In Word you can use ^p to find and replace end of line characters.

Code: Select all

Find:      BEGIN DSSUBRECORD^p         Name "CODE"
Replace With:|ZZ|^p      BEGIN DSSUBRECORD^p         Name "CODE"
Now replace the |ZZ| with the new parameter.

Code: Select all

Replace:|ZZ|
With:     BEGIN DSSUBRECORD^pName="NewParamName"^pPrompt="New Prompt"^pDefault="Whatever"^ParamType=0^pEND DSSUBRECORD
Should give you this before each job in the export file:

Code: Select all

BEGIN DSSUBRECORD
Name "NewParamName"
Prompt "New Prompt"
Default "Whatever"
ParamType "0"
END DSSUBRECORD
BEGIN DSSUBRECORD
         Name "CODE"
         Prompt "Enter a code"
         Default "MONARO"
         ParamType "0"
      END DSSUBRECORD
Not as good as parameter manager. There is a good chance that this could corrupt your export file so don't go overwriting anything you haven't got backed up!
kduke
Charter Member
Charter Member
Posts: 5227
Joined: Thu May 29, 2003 9:47 am
Location: Dallas, TX
Contact:

Post by kduke »

Ray is right. PM will add the parameter to all the jobs. I also posted code which will copy parameters. The hard part is changing the table name to a parameter. Creating the parameter is a lot easier.
Mamu Kim
Post Reply