How the find a File in the Directory in DOS

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

reddy
Premium Member
Premium Member
Posts: 168
Joined: Tue Dec 07, 2004 12:54 pm

How the find a File in the Directory in DOS

Post by reddy »

Sir,

I have a situation like this:

I have a sequencer with lot of jobs,Before running one of cleanup job i have tp look for particular file in directory.Please put light on me.

It's windows OS.

Thanks for help.

Narasa
kommven
Charter Member
Charter Member
Posts: 125
Joined: Mon Jul 12, 2004 12:37 pm

Post by kommven »

wait for file activity is perfect for you.
I presume wildcard doesn't work here. You should have a specific file name.

Clarification do you have server on the machine where the file arrives?
reddy
Premium Member
Premium Member
Posts: 168
Joined: Tue Dec 07, 2004 12:54 pm

Post by reddy »

Sir,

Sorry for confusing you.My question is how can i look for a particular file in a directory before running another job based on i will decide which i have to run.
I think i have to before subroutine using DOS Batch file.
But i don't know the scriprt.
Please light on me.

Thanks
Narasa
kduke
Charter Member
Charter Member
Posts: 5227
Joined: Thu May 29, 2003 9:47 am
Location: Dallas, TX
Contact:

Post by kduke »

I a routine you can open the directory like a hash file.

Code: Select all

Ans = @FALSE
DirName = Arg1
FileName = Arg2
openpath DirName to MyDir then
   read Rec from MyDir, FileName then
      Ans = @TRUE
   end
end
Mamu Kim
reddy
Premium Member
Premium Member
Posts: 168
Joined: Tue Dec 07, 2004 12:54 pm

Post by reddy »

Sir,

I have to look for 40 files if any of them exists i have to run job a other wise job b. how can i write routine for it please halp me.

Thanks
Narasa
kduke
Charter Member
Charter Member
Posts: 5227
Joined: Thu May 29, 2003 9:47 am
Location: Dallas, TX
Contact:

Post by kduke »

I gave you a routine to find one file. You should be able to find the next 39. We are not here to do your job. Just point you in the right direction.
Mamu Kim
reddy
Premium Member
Premium Member
Posts: 168
Joined: Tue Dec 07, 2004 12:54 pm

Post by reddy »

Hello Sir,

I will give clear explanation here.

I have path of files like this \\data\USA\Processed.txt or
\\data\IND\Processed.txt
\\data\RUS\Processed.txt
\\data\CAN\Processed.txt
\\data\BRT\Processed.txt
.............................
Like this for 40 countries.If any on of the file exits i have to abort the job
before the jobX.
Is there any DOS command to find the file path like this

\\data\*\Processed.txt.

Please help me on this.

Thanks
Narasa
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Take a good look at the "dir /s Processed.txt" command in dos, this will give you a list of the files found. You can write a Function that calls this command and gets the result in a string.
reddy
Premium Member
Premium Member
Posts: 168
Joined: Tue Dec 07, 2004 12:54 pm

Post by reddy »

Thanks a lot sir.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

There is a little-known utility that ships in the DataStage bin folder. The utility is called uvwalk and can perform a treewalk in a directory structure, much like find does in UNIX.

This might provide a more flexible solution.

Get to a DOS prompt and execute uvwalk with no command line arguments; it will issue a "this is the correct syntax" message showing you the options.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
kumar_s
Charter Member
Charter Member
Posts: 5245
Joined: Thu Jun 16, 2005 11:00 pm

Post by kumar_s »

uvwalkbefore tthat, we need to set the path for executing the command right? :roll:
coz its not working for me, (parallel EX)

reagrds
kumar
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Why should uvwalk be different from any other operating system command? :roll:
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

If you expect some help, you might want to explain what 'not working for me' means. :roll:

What you've tried, what error message you've gotten, that sort of stuff.

(I wonder, how many posts in a row can we get with rolly eyes in it?)
-craig

"You can never have too many knives" -- Logan Nine Fingers
kumar_s
Charter Member
Charter Member
Posts: 5245
Joined: Thu Jun 16, 2005 11:00 pm

Post by kumar_s »

I could not find uvwalk in the bin directory,if searched in

Code: Select all

/ds/Ascential/DataStage/DSEngine/bin
should i have to find it any where else :roll:
(i cant stop rolling my eys)

regards
kumar
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Kumar,

I have 7.5.1 on AIX and couldn't find it either, perhaps Ray is referring to a Windows-only executable... especially as UNIX does have a "find".
Post Reply