Page 1 of 1

How to pass a variable date as a parameter in dsjob

Posted: Wed Nov 17, 2010 7:06 pm
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

Posted: Wed Nov 17, 2010 7:52 pm
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

Posted: Thu Nov 18, 2010 4:58 am
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

Posted: Thu Nov 18, 2010 5:12 am
by ArndW
Instead of the '2010-11-18' value that ray suggested, use $Starttime.

Posted: Thu Nov 18, 2010 5:15 am
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.

Posted: Thu Nov 18, 2010 5:25 am
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

Posted: Thu Nov 18, 2010 5:31 am
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.

Posted: Thu Nov 18, 2010 6:45 am
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

Posted: Thu Nov 18, 2010 7:24 am
by SwathiCh
Hi,

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

Thanks

Posted: Thu Nov 18, 2010 7:28 am
by aladap12
hI

Thanks for the reply

Our MJC is a Basic Server Job


Thanks

Posted: Thu Nov 18, 2010 11:28 pm
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.

Posted: Fri Nov 19, 2010 6:20 am
by aladap12
thank you somuch for reply Aruna