MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Loosing leading Zeros in Excel file from mainframe(Cobol)

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming
View previous topic :: View next topic  
Author Message
santi.sworup
Beginner


Joined: 24 Jul 2010
Posts: 3
Topics: 2

PostPosted: Sun Jul 25, 2010 7:38 pm    Post subject: Loosing leading Zeros in Excel file from mainframe(Cobol) Reply with quote

Hi

My code is in Mainframe COBOL. I am able to send Email with an Excel attachment successfully thru JCL. The problem is if the data is plain number.. the leading zeros are removed..

I want the numbers to be displayed as 000089 instead of just 89.

To implement this fix, I double quote each field with leading zeros or spaces and place an equals sign (=) directly ahead of the first quote, like this below:
="000089"

It works . But user will use the excel file to be uploaded into their system. The =" gives them error.

I want to fix the issue in mainframe cobol. Is there anyway to fix this issue?
While sending the data as email attachment thru JCL , can we have any way to let excel treat my data as text type?

Please help me in solving this issue.
Back to top
View user's profile Send private message
Nic Clouston
Advanced


Joined: 01 Feb 2007
Posts: 1075
Topics: 7
Location: At Home

PostPosted: Mon Jul 26, 2010 1:50 am    Post subject: Reply with quote

Why use = ??? Surely just quoting the text is enough?
_________________
Utility and Program control cards are NOT, repeat NOT, JCL.
Back to top
View user's profile Send private message
Anuj Dhawan
Intermediate


Joined: 19 Jul 2007
Posts: 298
Topics: 7
Location: Mumbai,India

PostPosted: Mon Jul 26, 2010 4:31 am    Post subject: Reply with quote

I believe that's a "property of spread-sheet(excel)" - is the column-of-spread-sheet in which you populate the above said values is defined as "text" instead of "number"? If the column is defined as "number" - "000089" will be converted to "89".
_________________
Regards,
Anuj
Back to top
View user's profile Send private message
santi.sworup
Beginner


Joined: 24 Jul 2010
Posts: 3
Topics: 2

PostPosted: Tue Jul 27, 2010 7:50 am    Post subject: Reply with quote

yes..
The property of Excel is like if it finds a numeric value in the starting of a column, it will treat the field as numeric.
So even if we are marking the column as text in our program, the Excel property overrides it.
_________________
Santi
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12375
Topics: 75
Location: San Jose

PostPosted: Tue Jul 27, 2010 10:22 am    Post subject: Reply with quote

santi.sworup,

Send the same file one as excel and the other as plain text file without the = and quote. The text file without the = and quotes will be used to load the table and the other to open in excel.

Kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Franko
Beginner


Joined: 04 Feb 2010
Posts: 8
Topics: 0
Location: Kansas City

PostPosted: Tue Jul 27, 2010 12:18 pm    Post subject: Reply with quote

Try formatting the entire column: 1) Format cells, 2) Custom, 3) 000000. This should provide the leading zeros you require.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Anuj Dhawan
Intermediate


Joined: 19 Jul 2007
Posts: 298
Topics: 7
Location: Mumbai,India

PostPosted: Wed Jul 28, 2010 12:08 am    Post subject: Reply with quote

Franko wrote:
Try formatting the entire column: 1) Format cells, 2) Custom, 3) 000000. This should provide the leading zeros you require.
Yes, that's what I did when needed the similar thing last. If you want to retain the leading zeros, either format the column (in spread-sheet) as "text" or use "custom".
_________________
Regards,
Anuj
Back to top
View user's profile Send private message
misi01
Advanced


Joined: 02 Dec 2002
Posts: 629
Topics: 176
Location: Stockholm, Sweden

PostPosted: Thu Aug 12, 2010 3:53 am    Post subject: Reply with quote

... or simply try appending one single quote in front of the numeric values whose leading zeroes you want to retain
Back to top
View user's profile Send private message Send e-mail
Cogito-Ergo-Sum
Advanced


Joined: 15 Dec 2002
Posts: 637
Topics: 43
Location: Bengaluru, INDIA

PostPosted: Mon Aug 23, 2010 10:56 am    Post subject: Re: Loosing leading Zeros in Excel file from mainframe(Cobol Reply with quote

santi.sworup wrote:
Hi

My code is in Mainframe COBOL. I am able to send Email with an Excel attachment successfully thru JCL.


That is mis-leading.

MS Excel is a proprietary format and unless you have a package on mainframe (perhaps, JDBC ?) you wouldn't directly convert your mainframe PS to a Excel directly. I am guessing, you are sending a .csv file which the end-user is opening in MS Excel. If yes, so long the 'received' .csv file shows leading zeros, et al (in say, Notepad, etc.), you are fine. Else, as mentioned by others, it is an Excel 'feature'.
_________________
ALL opinions are welcome.

Debugging tip:
When you have eliminated all which is impossible, then whatever remains, however improbable, must be the truth.
-- Sherlock Holmes.
Back to top
View user's profile Send private message
misi01
Advanced


Joined: 02 Dec 2002
Posts: 629
Topics: 176
Location: Stockholm, Sweden

PostPosted: Sat Aug 28, 2010 2:51 am    Post subject: Reply with quote

Funny - if you google this problem you find both suggestions (one leading quote and ="0000number")

Just tried testing it myself with a CSV file on my desktop with the following contents
Code:

="00000111";Line 1
00000222;Line 2

I then started Excel and imported it using data,import and specified it as a ; separated file I saw the leading zeroes for 111 (but, as expected, not for 222).
However, when I double-clicked on the the actual CSV file, I saw the contents exactly as-is.
So the possible question is - HOW are the users importing/loading the data you send them via e-mail ?
Back to top
View user's profile Send private message Send e-mail
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12375
Topics: 75
Location: San Jose

PostPosted: Sat Aug 28, 2010 1:18 pm    Post subject: Reply with quote

misi01,

Check this post and the solution posted by me

http://www.mvsforums.com/helpboards/viewtopic.php?p=41425#41425

Kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
misi01
Advanced


Joined: 02 Dec 2002
Posts: 629
Topics: 176
Location: Stockholm, Sweden

PostPosted: Sun Aug 29, 2010 2:03 am    Post subject: Reply with quote

Hi Kolusu. I read your linked article, but as I mentioned in my append just above, it all depends on how you open the data file.

Michael
Back to top
View user's profile Send private message Send e-mail
Crox
Beginner


Joined: 29 May 2004
Posts: 52
Topics: 9

PostPosted: Mon Aug 30, 2010 11:40 am    Post subject: Reply with quote

it is possible to create a totally other kind of type file to download to excel. Did you ever investigate the SYLK format? The normal extension for SYLK is .SLK

You can create a true spreadsheet with that, with all kinds of extra features compared to csv like calculating rules, colors, shade, things like that.

Also it is possible to create the sheet in a completely other order than it is shown. In the Sylk format it is possible to write the last cell first and the other way around. I use SYLK a lot.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group