use of Variables in the query part of ODBC stage

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
sajidkp
Participant
Posts: 114
Joined: Thu Apr 30, 2009 12:17 am
Location: New Delhi

use of Variables in the query part of ODBC stage

Post by sajidkp »

Hi,

I have a value stoed in a file , it is a datetime value of prevoius run's mac date. now i want to use this value in the extraction query which is in an ODBC stage . Is there anyway to do this thing. please h elp me
Regards,
Sajid KP
Rubu
Premium Member
Premium Member
Posts: 82
Joined: Sun Feb 27, 2005 9:09 pm
Location: Bangalore

Re: use of Variables in the query part of ODBC stage

Post by Rubu »

Use a job sequence, and call your job using a job activity.

Write a routine/script to get the value from the file, use a user variable/or command activity before the job activity calling your job. Pass the user variable, which is your date time stored in file, to a job parameter (say DTTM). now you can use this parameter i your ODBC stage as #DTTM#.
Regards
Palas
sajidkp
Participant
Posts: 114
Joined: Thu Apr 30, 2009 12:17 am
Location: New Delhi

Re: use of Variables in the query part of ODBC stage

Post by sajidkp »

Rubu wrote:Use a job sequence, and call your job using a job activity.

Write a routine/script to get the value from the file, use a user variable/or command activity before the job activity calling your job. Pass the user variable, which is your date time stored in file, to a job parameter (say DTTM). now you can use this parameter i your ODBC stage as #DTTM#.
thanx alot Palas..
i will do that .. but i dont know how exactly routine has to write as i am new to DS. There should be some simple way for this, as its a common requirement right??.. Anyways thanx alot for your quick reply..
i will be thankfull if you can post a code for routine for reading from a file ...
Regards,
Sajid KP
priyadarshikunal
Premium Member
Premium Member
Posts: 1735
Joined: Thu Mar 01, 2007 5:44 am
Location: Troy, MI

Post by priyadarshikunal »

if there are only dates in that file, just use a command stage in the sequence and run cat command with the <path>/<filename> as parameter. the command output will be the value you want.
Pass the command output as value after removing the fiels marks.
Priyadarshi Kunal

Genius may have its limitations, but stupidity is not thus handicapped. :wink:
sajidkp
Participant
Posts: 114
Joined: Thu Apr 30, 2009 12:17 am
Location: New Delhi

Post by sajidkp »

priyadarshikunal wrote:if there are only dates in that file, just use a command stage in the sequence and run cat command with the <path>/<filename> as parameter. the command output will be the value you want.
Pass the command output as value after removing the fiels marks.
Thanx alot Priyadarshi Kunal

i have done this way . its working .. The forum and your comments was very usefull .. thanx alot
Regards,
Sajid KP
Post Reply