100 pts.
CL Commands
CL programming
File conversion
File formats
File Transfer Protocols
Microsoft Excel
I am using CPYTOPCD and emailing the resulting *.csv and *.txt files successfully.

However, I am now trying to send the data as an XLS. Although the file is sent, the data does not appear in the different cells as I would expect, the whole string (although comma delimited) appears a whole string (ie. Dealer Name,Deal Number,Buy/Sell) Do I need to send the data with a special delimter or something?

Software/Hardware used:
AS400, iSeries

Answer Wiki

Thanks. We'll let you know when a new response is added.

You would probably be better off with the newer command CPYTOIPMF but in either case what you create is an .csv file. Excel will open a .csv file using the comma’s as column delimiters.

Creating a .XLS file requires a lot more than just comma’s between the fields. There are a number of third party packages for this.


Note that sending a file through SMTP e-mail can require far more than simply copying the file to a /QDLS folder. If the file contains any bytes that are not simple text bytes, then the file can only be sent as a MIME attachment. And it’s likely that you’ll need to prepare it as a base64 encoded (or one of the other potentially appropriate encodings) file and also set the e-mail body to include the appropriate MIME headers that describe what the attachment is.

An actual Excel spreadsheet file is going to have lots of control codes and non-text bytes embedded within it.

SMTP cannot transfer bytes except those that are classified as “quoted printable”, basic ASCII text characters. That’s a fundamental restriction on how SMTP servers work. If you don’t follow SMTP rules, there’s no guarantee that the recipient will see a useful file.

Therefore, in order to send an attached file that has characters with hex values outside of that range, the file must be converted (encoded) into a form that uses only the valid characters. The most common form is BASE64 encoding.

You can create the encoded version yourself or you can install and use a product (or utility) that does it for you. Either way, you most likely will <b>not</b> be using CPYTOPCD anywhere in the process.


Discuss This Question:  

There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

Thanks! We'll email you when relevant content is added and updated.


Share this item with your network: