How to pass a variable date as a parameter in dsjob

A forum for discussing DataStage<sup>®</sup> basics. If you're not sure where your question goes, start here.

Moderators: chulett, rschirm, roy

Post Reply
aladap12
Participant
Posts: 60
Joined: Fri Jul 20, 2007 1:15 pm
Location: NO

How to pass a variable date as a parameter in dsjob

Post by aladap12 »

Hi

I have requirement, where I have to read a text file which contains o one date value.I have to send this date as job parameter, Later I have to use that parameter in my SQL Query.

How Can I achive this? Please let me know. I appriciate your time.

Note : we are not using Sequencer Jobs


Thanks
Vkr
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Create the job with a Date type job parameter.
When the job is submitted, provide a legal date value (in YYYY-MM-DD format).
For example

Code: Select all

dsjob -run -param jpMyDate='2010-11-18' -jobstatus project jobname
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
aladap12
Participant
Posts: 60
Joined: Fri Jul 20, 2007 1:15 pm
Location: NO

Post by aladap12 »

Thank you for the updates.

Let me enhance my requriement.I have a sub query,that fetches a date from one table.I am using that date in my main query.We have observed that if I have used the sub Query in my main Query, It is taking longer window to fetch records.

To over come this,I have came up with a design like,

First execute the SubQuery and load that into a sequential file.

Now I have read the file and pass the value to DS Job param,Then I will use that parameter in my sql query.

Starttime=`cat /home/vkrp/testfile.txt`

I have confusion on how to pass the value in seq file to Job parameter.

Please advise me on this? Thanks in Advance
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Instead of the '2010-11-18' value that ray suggested, use $Starttime.
ArunaDas_Maharana
Participant
Posts: 42
Joined: Thu Dec 11, 2008 11:07 am

Post by ArunaDas_Maharana »

the way i understood your design is :

1st job creating a sequencial file with subquery to get the date field
(which you are reading through unix command)
2nd job actual extract query

Now, if these two jobs are in different sequencer job is easy just map your jobparameter while calling your dsjob -param <paramset>.<jpName> =$Starttime

else if these two jobs are in same sequencer and you have to pass the jobparameter value at run time try using execute command between the jobs in sequencer canvas.
aladap12
Participant
Posts: 60
Joined: Fri Jul 20, 2007 1:15 pm
Location: NO

Post by aladap12 »

Thanks for the response,

We are using batch jobs.We are passing all the parameters in prm file.
Job execution order in csv file to Master Job Control.

If I do the bellow way,

dsjob -param <JParam>=$Var

I am sure it will pass the value to control job. How would it pass to actual job? Please advise me
ArunaDas_Maharana
Participant
Posts: 42
Joined: Thu Dec 11, 2008 11:07 am

Post by ArunaDas_Maharana »

is ur control job a sequencer job which controls the flow of the jobs

if yes while configuring job activity the sequencer will over right the value of the job called.
ArunaDas_Maharana
Participant
Posts: 42
Joined: Thu Dec 11, 2008 11:07 am

Post by ArunaDas_Maharana »

Sorry... :oops: completely missed your note

Note : we are not using Sequencer Jobs

Could you pls share some more info about your master job is this a parallel job/server basic job which reads your param file and csv file of job names to call the jobs in sequence.

Please elaborate on your master control job
SwathiCh
Premium Member
Premium Member
Posts: 64
Joined: Mon Feb 08, 2010 7:17 pm

Post by SwathiCh »

Hi,

Master Job control is a basic Server job, It will take csv(Job Hierarchy File) and .ini (Parameter file)

Thanks
aladap12
Participant
Posts: 60
Joined: Fri Jul 20, 2007 1:15 pm
Location: NO

Post by aladap12 »

hI

Thanks for the reply

Our MJC is a Basic Server Job


Thanks
ArunaDas_Maharana
Participant
Posts: 42
Joined: Thu Dec 11, 2008 11:07 am

Post by ArunaDas_Maharana »

In that case your master job would have a polling mechanism for triggering and it might be looping through list of jobs in csv files, after reading your .ini file.

update your .ini file with startdate parameter and csv with your job 1st creating startdate file then your select job.

Here you just need to make sure as in run time this parameter is being created just read your .ini file inside the job loop or think check your logic you need to get this parameter before you call your select job.
aladap12
Participant
Posts: 60
Joined: Fri Jul 20, 2007 1:15 pm
Location: NO

Post by aladap12 »

thank you somuch for reply Aruna
Post Reply