I want to FTP Flatfile (Urgent, pls tell me the solution)

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
sasidhar_kari
Premium Member
Premium Member
Posts: 62
Joined: Wed Dec 08, 2004 2:26 am

I want to FTP Flatfile (Urgent, pls tell me the solution)

Post by sasidhar_kari »

Hi All


I have a flat file (csv) with 40 columns, i want to FTP the flatfile to other place. Here my question is can i ftp flatfile with 40 columns using Datastage FTP Stage. If so can u pls tell me how can i FTP Flatfile.

I m trying in my job as,

SequentialFile -----> FTP Stage.

but i m unable to ftp the file.

I m not using any transfomer stage in between sequential stage and FTP stage.

File is not getting ftping.

Can u pls tell me what are the steps i need to follow.

Thanks in Advance
SAS
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Re: I want to FTP Flatfile (Urgent, pls tell me the solution

Post by chulett »

sasidhar_kari wrote:I have a flat file (csv) with 40 columns, i want to FTP the flatfile to other place. Here my question is can i ftp flatfile with 40 columns using Datastage FTP Stage.
Yes, you can! Even one with 40 columns. :wink:
but i m unable to ftp the file.
Why not? :?
I m not using any transfomer stage in between sequential stage and FTP stage.
That's fine. Perhaps not ideal, but shouldn't stop it from working.
File is not getting ftping.
Again, why not? What kind of error messages are you getting? Have you tried ftp'ing the file from the command line to verify that you have the proper information for the target system - host, userid, password, target directory, etc - all are valid? Have you tried setting the Trace Level up higher than zero in the stage to gather more information?
Can u pls tell me what are the steps i need to follow.
First make sure you can ftp the file to the intended location outside of a DataStage job. Then, the only steps after that are to properly configure the FTP Stage in your job to match.
Urgent, pls tell me the solution
No, it's not. :? We're all volunteers here, are glad to help and - here's the key - post when we can. If you truly have an 'urgent' need for an answer, call your Support provider and tell them it's urgent.
-craig

"You can never have too many knives" -- Logan Nine Fingers
sudharsanan
Participant
Posts: 64
Joined: Fri Jul 16, 2004 7:53 am

Post by sudharsanan »

HI SAS,


Some more inputs about FTP Stage, whenever you involve in FTP staging try to have some checking before and after the FTP stage. You can use your own logic to check whether the FTP has been completed successfully or not.. for example, you can have header and footer on your file and check for the same on the file after the FTP. can you provide some information on what is the problem you are actually facing...

I hope this information will be useful...


Thanks
Sudharsanan AN
sasidhar_kari
Premium Member
Premium Member
Posts: 62
Joined: Wed Dec 08, 2004 2:26 am

Post by sasidhar_kari »

Thanks Sudarsanan for u r replay,

Now i m able to FTP the file from my Dev server to FTP Server.

Now the problem is in the output after FTP, i need to use TAB Delimiter . I mean i need TAB Delimited output file. I m using 009 as tab delimiter in the FTP stage it self but in the output file '0' is coming in between the values like SIN123 0 AWB456 0 239 0 . Actually my original data is
SIN123 AWB456 239. zero is coming between the values. Can any one help me in this regard.

Thanks in Advance.

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

Post by ray.wurlod »

Are you having zeroes AND tabs between your data, or just zeroes?

Either way you can use Ereplace() or Change(). For example;

Code: Select all

Ereplace(InLink.TheString), " 0 ", Char(9), -1, 0)
Note that the second argument has three characters, space zero space, because this is how you described your data.

If there are no spaces the problem is more difficult unless your data are in fixed-width format, in which case you can use substring techniques to extract individual field values, and concatenation to assemble the required result.

Tip: Create a stage variable svTab, initialized to Char(9) and not derived, and use this instead of Char(9) for tab. That way you only evaluate the function Char(9) once.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
sasidhar_kari
Premium Member
Premium Member
Posts: 62
Joined: Wed Dec 08, 2004 2:26 am

Post by sasidhar_kari »

Hi Ray,

I have only Zeros between the data. Data coming to the FTP stage is TAB delimited. I m using 009 as TAB Delimiter when i m loading data to the Flatfile and i m using that tabdelimited file as source to the FTP Stage.


Is 009 works as tabdelimiter for the Flatfile?

Thanks in Advance
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Since the FTP stage is metadata driven it can hork up your data during the process if everything isn't exactly right. It sounds like somehow the FTP stage thinks it needs to add the zeroes for you. What is the delimiter setting you are using in the FTP stage itself? :?

:idea: A 'trick' you might want to try with the FTP stage. If your flat file has already been created to look like what it should look like on the target system (and it usually has been) - then lie about it. :wink: By 'lie' I mean define the record as a single, long string in the feeder Sequential File stage.

So, for a delimited file, pick the longest the record could be and tell it that you have a single Varchar field of that size. Set the delimiter in the Sequential stage to something not in the data - like a pipe or a caret. Won't matter what you tell it the delimiter is to use in the FTP stage as it won't add one. The only problem becomes the quote character, so set that to blank ('000' in the Sequential, literally blank from what I recall in the FTP stage) so it won't add quotes around each record as it sends them.

Something to consider if you have issues getting it to work as is...
-craig

"You can never have too many knives" -- Logan Nine Fingers
Post Reply