HELPP!!

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
slavik0329
Participant
Posts: 11
Joined: Tue Jan 10, 2006 2:33 pm

HELPP!!

Post by slavik0329 »

I'm working on a project which requires me to read a timestamp from a file and then use that within a WHERE clause. How can I accomplish this?
jzparad
Charter Member
Charter Member
Posts: 151
Joined: Thu Apr 01, 2004 9:37 pm

Post by jzparad »

The only way you can use a variable in a where clause is using a job parameter. Not quite true because you can also use the variable to create an SQL file on the fly and then run the SQL file.

In both cases you first have to get the timestamp. On UNIX this is trivial and fairly common. On Windows you can do this using VBScript, a DOS batch file (maybe) or using DataStage itself. As far as I'm aware, there is no DataStage BASIC function that can return the timestamp of a file. If someone out there knows of one, please let us all know.

My solution would be to list the directory and redirect output to a file. The file can then be parsed to extract the required value. Once you have that value, you can pass it to another job which executes the query.
Jim Paradies
slavik0329
Participant
Posts: 11
Joined: Tue Jan 10, 2006 2:33 pm

Post by slavik0329 »

I do not need to extract the timestamp of the file. there is an actual timestamp string in the txt file. thats all it holds.
jzparad wrote:The only way you can use a variable in a where clause is using a job parameter. Not quite true because you can also use the variable to create an SQL file on the fly and then run the SQL file.

In both cases you first have to get the timestamp. On UNIX this is trivial and fairly common. On Windows you can do this using VBScript, a DOS batch file (maybe) or using DataStage itself. As far as I'm aware, there is no DataStage BASIC function that can return the timestamp of a file. If someone out there knows of one, please let us all know.

My solution would be to list the directory and redirect output to a file. The file can then be parsed to extract the required value. Once you have that value, you can pass it to another job which executes the query.
jzparad
Charter Member
Charter Member
Posts: 151
Joined: Thu Apr 01, 2004 9:37 pm

Post by jzparad »

That makes it much easier. You can create a job sequence with a routine that reads the file and returns the timestamp. The value can then be passed to a job activity that calls your main job.

Lot's of examples on reading a sequential file on this forum.
Jim Paradies
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Please try to choose a meaningful subject for your posts. It helps others who are searching the forum later.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply