Search for Data File on share drive

A forum for discussing DataStage<sup>®</sup> basics. If you're not sure where your question goes, start here.

Moderators: chulett, rschirm, roy

Post Reply
imfarhan
Participant
Posts: 53
Joined: Tue Jul 24, 2012 9:34 am

Search for Data File on share drive

Post by imfarhan »

Hi All,
Sorry I'm new on DataStage(InfoSphere). I only used basing stage control in jobs.

What I want?

I would like to (1) check the file on share dirve and once the file found (2)I like to pull through. I think the (2)nd step I can do but , could you please advise me for (1)

What I've done so-far

I was looking one of the control "External_Source" I think it allows to use Batch or Parameters ; If I use this control(stage) control , shoudl I use batch file or use Parameter.

If I use batch file , What shall I write on batch file and how can I link to the control as control only allow me to write the name of batch file

I'm using Parallel job ver 8.7

I hope it make sense.
Regards
Farhan
Farhan Syed
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Easiest to use would be a sequence with a WaitForFile activity.

Next easiest would be a before-job subroutine using ExecSH to execute a command to check for the file's existence.
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 »

(actually, I just deleted the accidental hijack of the other thread since this had already been created)

Is this shared drive acccessable from the ETL server?
-craig

"You can never have too many knives" -- Logan Nine Fingers
imfarhan
Participant
Posts: 53
Joined: Tue Jul 24, 2012 9:34 am

Post by imfarhan »

Thanks for the reply...

No the source file is not on the ETL Server?

What I've done after your suggestion
Create a new job simple Sequence-Job and
browse the Run.bat file but its not working do I've to pass any parameters

I've run my batch command on cmd window and its working fine but through Sequence job its not?
Please advise
Many thanks
Farhan Syed
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

While there is usually just one way for a job to run correctly, there are very many ways for it not to run. Without stating what happened and how the job failed (error messages, for example) there is little chance of getting a good answer that goes beyond guesswork.
imfarhan
Participant
Posts: 53
Joined: Tue Jul 24, 2012 9:34 am

Post by imfarhan »

The following syntax I've written in my bat file.

Code: Select all

echo "Testing"
REM 

REM    xcopy /s "T:\Info_Team\Farhan\ETL\DW RFC\CC_xx_Infection_Control\*.csv" "X:\Training\Farhan\Infection_Control\"
       xcopy /-y "X:\Training\Farhan\Infection_Control_SAmple_Extractxls.csv"    "X:\Training\Farhan\Infection_Control\"
The message through Job-Director is as follows:
...
....

10:42:05 Info Testing_Copy_CSV_File.JobControl(@Coordinator):Summary of sequence run()
10:42:05 Finish Job Testing_Copy_CSV_file
Farhan Syed
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

That isn't much in the way of error messages. Try a "reset" of your job and then see if you find an entry in your log file with the text "from previous run..."

How are you calling up this .bat file in the after-job?
imfarhan
Participant
Posts: 53
Joined: Tue Jul 24, 2012 9:34 am

Post by imfarhan »

Sorry don't know what happed to my browser posted one reply several times..

After the last post I took following stesp

(1) Reset the job by closing the datastage.
(2) create a fresh job
(3) Deploy "Execute_Command"
(4) Assign the BAT file through browser on "Command" line
G:\Command\Run_Copy_Infection_Control.bat

(5) Now I've added the "Environmental variable whic is default for all jobs
(6) The error is prompting now bere there was no error "fatal error from @taStop): "


I may be making some fundamental mistake.....do I have to use Parameter as this batch filed doesn't required.
Appreciate your help!
Regards
F
Farhan Syed
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

What do you mean in steps 3 and 4?

is "execute_command" your routine? Since your original post stated a job sequence, wouldn't "ExecSH" be sufficient?
imfarhan
Participant
Posts: 53
Joined: Tue Jul 24, 2012 9:34 am

Post by imfarhan »

(3) Use the "Execute_Command" in SEQUENCE job. No its not a routine.
I've only use "Execute_Command" in my sequence job
(4) Call my bat file like as follow under Command:

G:\Command\Run_Copy_Infection_Control.bat
Hope make sense
Farhan Syed
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Yes, that now makes sense, the use of "deploy" confused me, since that usually means to install software or the like.

Are you certain that your sequence log contains no more messages regarding executing this batch? You could also put an "ECHO" command as the first line in the batch to make sure that the batch is being called (You need to specify the path to the batch relative to the server, not your client pc - so drive "G" must be the present viewed from the server).
imfarhan
Participant
Posts: 53
Joined: Tue Jul 24, 2012 9:34 am

Post by imfarhan »

Thanks to all of you.

Its surprised .. didn't like "xcopy" so I try to use "copy" command and its works
copy "G:\Training\Farhan\Infection_Control_SAmple_Extractxls.csv" "G:\Training\Farhan\Infection_Control\"
Now I'm going to try to copy (Srouce) from outside the ETL SErver lets see its work or not

Regards
F
Farhan Syed
Post Reply