Page 1 of 1
Exec Dos Command
Posted: Mon Mar 20, 2006 3:48 am
by Umbix62
Hi there
I have to exec a Dos command in the before routine as this:
"Echo 2006/03/20 > pippo.dat"
to create a flat file at the end of this job, if it run without errors. In this file I have to insert only one row with the current data, as for example "2006/03/20". How can I do that? I can put the current date in the command, using for example, the DataStage variable @date? I know I can use a parameter contained the current date but I'ld know if there is a direct method to do that without using parameters.
Thank you
Umberto
Posted: Mon Mar 20, 2006 4:29 am
by ArndW
Umberto,
I am not sure about what you need to do; you posted the question as a UNIX server one, but are asking about DOS; you stated that you want a "before routine" to do something after the job completes successfully.
If you has a DOS server installation, you can simply execute
as a shell command to put the current system date into a file.
Posted: Mon Mar 20, 2006 7:49 am
by chulett
Make sure you enable the 'Only run after successful completion' option.
![Wink :wink:](./images/smilies/icon_wink.gif)
Posted: Mon Mar 20, 2006 12:43 pm
by ray.wurlod
A similar approach for UNIX also involves the date command; the picture option is set according to your requirements. For example
But, as Arnd noted, we are not sure whether you are asking about UNIX (your job type in post header) or DOS (your post body).
Posted: Tue Mar 21, 2006 3:22 am
by Umbix62
ArndW wrote:Umberto,
I am not sure about what you need to do; you posted the question as a UNIX server one, but are asking about DOS; you stated that you want a "before routine" to do something after the job completes successfully.
If you has a DOS server installation, you can simply execute
as a shell command to put the current system date into a file.
Ok, it works. Thank you very much. I did it in a Unix environment with touch command. Now I work in a Windows 2003 Server and I don't know the Dos Command.
Thank you again to everybody
Umberto
Posted: Tue Mar 21, 2006 4:17 am
by ray.wurlod
touch.exe ships with DataStage. It can be found in the Engine folder's bin subdirectory.
Posted: Wed Mar 22, 2006 3:50 am
by Umbix62
ray.wurlod wrote:touch.exe ships with DataStage. It can be found in the Engine folder's bin subdirectory. ...
This is the command I used in a Unix environment. I can't access this subdirectory. I have decided to use the command suggested "date /t > filename.dat". If I want to write in that flat file the current date and time?
Thank you
Umberto
Posted: Wed Mar 22, 2006 3:57 am
by ArndW
Umberto,
just as with date /t you can use the time /t command to get the current time output in dos.
Posted: Wed Mar 22, 2006 3:59 am
by Umbix62
ArndW wrote:Umberto,
just as with date /t you can use the time /t command to get the current time output in dos. ...
Ok, but if I want write togheter and not only one?
Posted: Wed Mar 22, 2006 4:12 am
by kumar_s
You can append one after other.
date /t > filename.dat
time /t >> filename.date
Posted: Wed Mar 22, 2006 4:17 am
by ArndW
Try "echo %DATE% %TIME% > filename.dat"
Posted: Wed Mar 22, 2006 4:20 am
by Umbix62
ArndW wrote:Try "echo %DATE% %TIME% > filename.dat" ...
Ok, it works. Thank you very much
Umberto