IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Sending CSV file in mail.


IBM Mainframe Forums -> PC Guides & IT News
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
passion_sujesh

New User


Joined: 14 Mar 2008
Posts: 74
Location: India,Chennai

PostPosted: Tue Dec 14, 2010 9:10 pm
Reply with quote

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?

Sujesh.
Back to top
View user's profile Send private message
superk

Global Moderator


Joined: 26 Apr 2004
Posts: 4652
Location: Raleigh, NC, USA

PostPosted: Tue Dec 14, 2010 9:34 pm
Reply with quote

Use a different format (possibly .slk?) for the data layout. Or, use some reverse-engineering logic and see if there is a way with .csv.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Tue Dec 14, 2010 9:37 pm
Reply with quote

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.
Back to top
View user's profile Send private message
passion_sujesh

New User


Joined: 14 Mar 2008
Posts: 74
Location: India,Chennai

PostPosted: Tue Dec 14, 2010 10:01 pm
Reply with quote

The MF report file has leading zeros in them, but the CSV attachment doesnt have the leading zeros. Please help

Thanks,
Sujesh
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Tue Dec 14, 2010 10:20 pm
Reply with quote

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?
Back to top
View user's profile Send private message
passion_sujesh

New User


Joined: 14 Mar 2008
Posts: 74
Location: India,Chennai

PostPosted: Tue Dec 14, 2010 10:28 pm
Reply with quote

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.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Tue Dec 14, 2010 10:45 pm
Reply with quote

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.
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Tue Dec 14, 2010 10:46 pm
Reply with quote

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?
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Tue Dec 14, 2010 10:55 pm
Reply with quote

Hello,

Suggest you look at the csv file after the download using a simple text editor. The leading zeros will be in place.

Then you need to look at how this file is imported - and probably change the way the fields are defined for the import.
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Tue Dec 14, 2010 11:00 pm
Reply with quote

ms excel strikes again.
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1788
Location: Bloomington, IL

PostPosted: Tue Dec 14, 2010 11:11 pm
Reply with quote

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.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> PC Guides & IT News

 


Similar Topics
Topic Forum Replies
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 1
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
Search our Forums:

Back to Top