Can we code to call the bat files inside batch file?

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
ICE
Participant
Posts: 249
Joined: Tue Oct 25, 2005 12:15 am

Can we code to call the bat files inside batch file?

Post by ICE »

Dear All,

1.May I know whether I can run the bat in batch file?I don't want to run from outside(before/after job routine) place.I like to call it from the job control.Can I do that?
2. My DOS bat file doesn't work properly when I call it on after job routine stage.
That DOS bat file suppose to delete the output files those have been created by that job itself.
Actually I like to del all those output files generated by that job after I finished it all so that I can use the append file option box while I generate the txt files for next time.Do you have any idea pls???
My senario is all follows.......
In my DS batch file,I called 4 jobs.
In 2 jobs,there are more than 2 files I have to import.I cannot use the hash file coz there may have duplicate key.So I try to import all those data to one output txt file.
There are 2 links to txt file.So I cannot use overwrite option and I try to use append option for the output txt file.
So everytime I run the job ,I suppose to clean the txt file before I import any data to there so that I can get the right data.
Now,do u have any idea???Help me pls.

:(



Thanks,
Last edited by ICE on Wed Nov 15, 2006 12:03 am, edited 1 time in total.
DeepakCorning
Premium Member
Premium Member
Posts: 503
Joined: Wed Jun 29, 2005 8:14 am

Re: Can we code to call the bat files inside batch file?

Post by DeepakCorning »

When you say delete files related to the job do you mean the output files generated by the job or the internal ones.

You can call a BAT file by a Comman Stage.
ICE
Participant
Posts: 249
Joined: Tue Oct 25, 2005 12:15 am

Re: Can we code to call the bat files inside batch file?

Post by ICE »

Hi Deepak,

What do u mean for internal ones?
In my batch job ,I called 4 jobs.
The 2nd and third job generate the txt output files.
Those output files get the data from more than one links.So I used the append txt file so that I will get the data from all input links.
That's why I suppose to delete those txt files before/after I run the batch job.
My bat file is used to del those txt files.
But that bat file doesn't work properly.

Help me pls......... :(

DeepakCorning wrote:When you say delete files related to the job do you mean the output files generated by the job or the internal ones.

You can call a BAT file by a Comman Stage.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Re: Can we code to call the bat files inside batch file?

Post by chulett »

ICE wrote:My bat file is used to del those txt files.
But that bat file doesn't work properly.
How can anyone help you will so little information posted? What would your mechanic say if you called and told them that your car "doesn't work properly", what kind of advice could he give you over the phone? :?

Post your "bat file"... wrap it in code tags to preserve the formatting. We'll start with that.
-craig

"You can never have too many knives" -- Logan Nine Fingers
ICE
Participant
Posts: 249
Joined: Tue Oct 25, 2005 12:15 am

Re: Can we code to call the bat files inside batch file?

Post by ICE »

Hi chulett,

My code is just simple .See here.

Deltxtfiles.bat

Code: Select all

cd d:\development\outfiles

if exist Bud_Con.txt del Bud_Con.txt
if exist Area.txt  del Area.txt
That's all.It's so simple.But that bat file still cannot work either I run it from before/after job routine stage or I coded inside the DS batch job.

Is there any other way to do it pls??? :idea:

Thank you so much for your respose.


chulett wrote:
ICE wrote:My bat file is used to del those txt files.
But that bat file doesn't work properly.
How can anyone help you will so little information posted? What would your mechanic say if you called and told them that your car "doesn't work properly", what kind of advice could he give you over the phone? :?

Post your "bat file"... wrap it in code tags to preserve the formatting. We'll start with that.
DeepakCorning
Premium Member
Premium Member
Posts: 503
Joined: Wed Jun 29, 2005 8:14 am

Re: Can we code to call the bat files inside batch file?

Post by DeepakCorning »

What happens when you use a Execute Command Stage and call this Bat file there?

Are u saying this Bat file itself is not working??
ICE
Participant
Posts: 249
Joined: Tue Oct 25, 2005 12:15 am

Re: Can we code to call the bat files inside batch file?

Post by ICE »

Dear Deepak,

Your "Execute command Stage" is what we can get in sequencer job.Right?
Currently ,I am using version 4 and so there don't have Execute command stage.
My Bat file can be run in MS DOS prompt but it doesn't work if I run it by double clicking over that prog.

What should I do???
The program is so simple but it really couldn't work.
What should I do????????
:(

DeepakCorning wrote:What happens when you use a Execute Command Stage and call this Bat file there?

Are u saying this Bat file itself is not working??
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

From a Job Control routine (in any version from 1.0 onwards)

Code: Select all

Shell = "NT"
Command = "Deltxtfiles.bat"   ; * or pathname of BAT file
Output = ""
ExitStatus = -999
Call DSExecute(Shell, Command, Output, ExitStatus)
Message = "Executed command: " : Quote(Command)
Message<-1> = "   Exit status = " : ExitStatus
Message<-1> = "   Output:"
Message<-1> = Output
Call DSLogInfo(Message, "Job Control")
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