CHECKING STRING AT FTP SERVER

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
khanparwaz
Participant
Posts: 60
Joined: Tue Jul 12, 2005 3:34 am

CHECKING STRING AT FTP SERVER

Post by khanparwaz »

Hi,
I have an a scenario where i have to check for a string 'TRAILER'
at FTP server Which is a NT server my datastage server is a unix server.
i want to load a file from Nt FTP server only when i get that string in that file, so how can i check for the string as no command available at ftp to check string at FTP.


thanks
kcbland
Participant
Posts: 5208
Joined: Wed Jan 15, 2003 8:56 am
Location: Lutz, FL
Contact:

Post by kcbland »

Your problem is that the file on the FTP server isn't complete until it has a text string at the bottom of the file. At that time you wish to fetch it from the site.

Given that there are limited Windoze commands for doing what is equivalent to a Unix tail command, can you tell us what options you do have? Is there MKS Toolkit or the like available on the Windoze machine whereby you could use tail? Are you able to write a short program and place on that server to give you the last line in the file? How big are these files? Are they small enought to fetch anyway and check locally using tail?
Kenneth Bland

Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle
khanparwaz
Participant
Posts: 60
Joined: Tue Jul 12, 2005 3:34 am

Post by khanparwaz »

Hi Kenneth Bland ,

Thanks for reply.
you have exactly understood my problem
actually in our previous release we did the same ie; taking the file to unix box then used a routine which were searching for string 'TRAILER' so if the string is present then only we process file.
now as we know that size of file is gonna be very big if we implement the same thing its gonna take very much time coz normally our process load 15 - 20 files a day .
thats why i was looking for a process or may be any script that can check the srting at remote machine.

we have all normal command available at ftp no mks kit is installed.
what kinda program you were talking about to place on server that can give me last line ?


Thanks
kcbland
Participant
Posts: 5208
Joined: Wed Jan 15, 2003 8:56 am
Location: Lutz, FL
Contact:

Post by kcbland »

Write a C/java/perl program/script to return TRUE/FALSE if the last line is your trailer record. Execute it remotely and act accordingly.
Kenneth Bland

Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle
khanparwaz
Participant
Posts: 60
Joined: Tue Jul 12, 2005 3:34 am

Post by khanparwaz »

is it possible any how if i can do it through shell script coz i am having option of that only in here.
kcbland
Participant
Posts: 5208
Joined: Wed Jan 15, 2003 8:56 am
Location: Lutz, FL
Contact:

Post by kcbland »

Well, how good are you at DOS .bat file writing? If you're limited to Windoze, you've only that scripting language, unless the server has perl or java. Performance might be an issue with DOS scripting.
Kenneth Bland

Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle
khanparwaz
Participant
Posts: 60
Joined: Tue Jul 12, 2005 3:34 am

Post by khanparwaz »

its ok you mean i have to create a batch file & feep that at mt FTP server NT machine & i dont know then how to access that .bat file how i will run that to get last line of file coz again the problem would be how to run .bat file to get the result . Can u tell me how can i use rlogin or ftpd options
kcbland
Participant
Posts: 5208
Joined: Wed Jan 15, 2003 8:56 am
Location: Lutz, FL
Contact:

Post by kcbland »

Look at using remsh or rsh to run remote commands on foreign servers. Better yet, why not just have a process running on that foreign server to monitor local files and once IT sees the trailer record it either creates a "ready" companion file or moves the file into a different area?
Kenneth Bland

Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle
Post Reply