Joined: 14 Mar 2008 Posts: 74 Location: India,Chennai
Hi,
I have an work in which I have to send an report in csv format (in mail). The report was mailed successfully. But in the report, for certain columns the leading zeros are suppressed. Is there any way we can retain the leading zeros. Can any one help me in this?
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
Are the leading zeros in the file before it is sent? If not, change the program generating the csv file to include the leading zeros. If they are there, then whatever is being done AFTER the report is received is getting rid of the leading zeros -- and you'll have to work with the report recipient to fix the issue.
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
Quote:
but the CSV attachment doesnt have the leading zeros
How do you know this? If the mainframe report file has leading zeroes, there is nothing in the SMTP mail process that would strip them out. Have you brought the attachment up in Notepad (or other text editor) and looked at the raw data transferred?
Joined: 14 Mar 2008 Posts: 74 Location: India,Chennai
In the CSV report if the colum has alphanumeric data (with leading zeros), the leading zeros are present. But if the column has numeric data all the leading zeros are suppresed.
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
You are not being clear with what you say. What does "alphanumeric data" mean to you -- typically, in COBOL (for example), alphanumeric data will NOT have leading zeros since it will be left-justified, filled with spaces to the right. Numeric data, depending upon the PICTURE clause used, will be justified to the decimal point (whether explicit or implicit) and will have leading zeros (unless they are suppressed).
It makes absolutely no sense to say
Quote:
alphanumeric data (with leading zeros)
since this cannot happen in COBOL, nor in most other languages.
From the very beginning:
1. What are you using to verify the data looks correct on the mainframe BEFORE THE EMAIL IS SENT?
2. What are you using the verify the data looks correct AFTER THE EMAIL IS SENT?
3. What does "in the CSV report" mean -- mainframe? PC? Unix? before the email is sent? after the email is sent?
It is YOUR responsibility to be absolutely clear about what your problem is, and so far from what you have posted there is not even a problem to be looked at. You have not told us how you know the csv attachment does not have the leading zeros -- if you are looking at it via Excel, for example, Excel will automatically suppress leading zeros unless told not to. But you cannot even tell us that you're looking at the attachment with Excel.
Please -- either completely and totally describe every step of the process and why you think there is a problem with it, or stop wasting our time by refusing to post requested information.
Joined: 19 May 2007 Posts: 1512 Location: Virginia, USA
passion_sujesh wrote:
In the CSV report if the colum has alphanumeric data (with leading zeros), the leading zeros are present. But if the column has numeric data all the leading zeros are suppresed.
What are you using to view the CSV file that is leading you to the conclusion that the leading zeros are missing?
Joined: 03 Oct 2009 Posts: 1788 Location: Bloomington, IL
passion_sujesh wrote:
In the CSV report if the colum has alphanumeric data (with leading zeros), the leading zeros are present. But if the column has numeric data all the leading zeros are suppresed.
Try prefixing these data with a single quote. This should indicate to Excel that what looks like a number is in fact a string.