FTP Excel 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
sathya_anjan
Participant
Posts: 20
Joined: Tue Feb 02, 2010 4:49 am
Location: United Kingdom

FTP Excel File

Post by sathya_anjan »

Hello,

I am trying to FTP a simple Excel file from a Remote path. I have configurated the settings correct. I say that, beacause if I FTP the Same Excel file as a CSV, it FTP's without any issues

My job Design is:

FTP Plug In --> ODBC (Excel Connection)

I have verified the Excel table connectivity in the ODBC stage and it looks correct

I get the below Error Message in the job, before it Termintes

Code: Select all

jb_FTP_XLS..ODBC_13.IDENT1: Unbalanced or unescaped quote character
At row 7, link "DSLink2", while processing column "areaname"
DSTAGE-FTP-0057`:`Unbalanced or unescaped quote character
Thanks

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

Post by ArndW »

You need to FTP the Excel file in binary mode, have you done that?
sathya_anjan
Participant
Posts: 20
Joined: Tue Feb 02, 2010 4:49 am
Location: United Kingdom

Post by sathya_anjan »

Yes, I have tried that. That would require Fixed-Width Column property to be set to YES. The excel sheet I am trying to FTP has a defined metadata and not fixed width

Also, If i use the Binary option will it not FTP unreadable data?

Thanks

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

Post by ArndW »

Sorry, I thought you were reading the remote excel file.

If you replace your ODBC connection with a sequential file stage writing just the column "areaname" without quotes then is there a line in that file which contains quotes which may not be balanced?
sathya_anjan
Participant
Posts: 20
Joined: Tue Feb 02, 2010 4:49 am
Location: United Kingdom

Post by sathya_anjan »

Ofcourse I am trying to Read a Remote Excel file and FTP that into my System

How can I write an Excel File data into Sequential file as .xls?

I need to read a Remote .xls Excel File and FTP that into my System as .xls Excel file using FTP Plug-in Stage

I have tried reading single column before (as Ascii), I am getting the same unbalanced Error message. However, when I try your Binary approach with a Single Column and setting the Fixed Width Property set to Yes, the job runs and I get a Binary output, which is unreadable

Thanks

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

Post by chulett »

sathya_anjan wrote:I need to read a Remote .xls Excel File and FTP that into my System as .xls Excel file using FTP Plug-in Stage
You can't. The stage is metadata driven and really only meant for flat files, which is why it works when you save the xls as a csv. Since you are on Windows, you can use ODBC to read the xls without converting it first but it still needs to be 'local' to the ETL server. If you need to FTP it first, use the command line to do it. Then there's really no need for DataStage at that point, unless you're just using it to schedule / monitor the process.
-craig

"You can never have too many knives" -- Logan Nine Fingers
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

As Craig has already pointed out, using FTP as a source means that the remote FTP server has to read the file, and FTP is limited to flat files.
You can FTP the Excel file (in binary mode, as mentioned earlier) to your DataStage Server and then use ODBC connectivity to read the data from the Excel file.
sathya_anjan
Participant
Posts: 20
Joined: Tue Feb 02, 2010 4:49 am
Location: United Kingdom

Post by sathya_anjan »

Thanks for the clarification Craig
ArndW wrote:You can FTP the Excel file (in binary mode, as mentioned earlier) to your DataStage Server and then use ODBC connectivity to read the data from the Excel file.
When I try your Binary approach with a Single Column and setting the Fixed Width Property set to Yes, the job runs and I get a Binary output, which is unreadable. How can I read a Binary Data in a ODBC Stage?
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

You need to FTP the Excel file using normal FTP and not the FTP stage. As said earlier, the FTP in DataStage is for processing remote flat files.
sathya_anjan
Participant
Posts: 20
Joined: Tue Feb 02, 2010 4:49 am
Location: United Kingdom

Post by sathya_anjan »

Alright!!

Well, I already have a Unix Script in place as a workaround, but wanted to achieve this via the Datastage FTP Stage

Thanks for your time and help

Cheers!!!

Sathya
BI-RMA
Premium Member
Premium Member
Posts: 463
Joined: Sun Nov 01, 2009 3:55 pm
Location: Hamburg

Post by BI-RMA »

ftp in binary-mode transfers files without trying to convert platform specific characters when moving a file from UNIX/Linux to Windows and vice versa, which ASCII-mode would do.

The result is a file that is transported unchanged from one machine to another. xls as a proprietary file-format is likely to be damaged when you try to transfer it by ftp in ASCII-mode.
"It is not the lucky ones are grateful.
There are the grateful those are happy." Francis Bacon
sathya_anjan
Participant
Posts: 20
Joined: Tue Feb 02, 2010 4:49 am
Location: United Kingdom

Post by sathya_anjan »

BI-RMA wrote:ftp in binary-mode transfers files without trying to convert platform specific characters when moving a file from UNIX/Linux to Windows and vice versa, which ASCII-mode would do.
I am aware about this. My FTP process is confined to Windows alone and I do not require the FTP to be set up as Binary. Ascii is working perfectly fine
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

No, ASCII mode does not work when copying an excel file, you need to specify BINARY mode.
sathya_anjan
Participant
Posts: 20
Joined: Tue Feb 02, 2010 4:49 am
Location: United Kingdom

Post by sathya_anjan »

It does with a Unix Script
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Yes, it works with typical text files. But if the file contains 0x00 (nulls) then a normal FTP will interpret that as an end-of-file marker and stop. EXCEL files contain nulls and thus won't transfer correctly.

Try FTPing a .JPG or .XLS file, even between Windows or UNIX machines, and you will see corruption unless you do so in binary mode.
Post Reply