View previous topic :: View next topic |
Author |
Message |
santi.sworup Beginner
Joined: 24 Jul 2010 Posts: 3 Topics: 2
|
Posted: Sun Jul 25, 2010 7:38 pm Post subject: Loosing leading Zeros in Excel file from mainframe(Cobol) |
|
|
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 |
|
|
Nic Clouston Advanced
Joined: 01 Feb 2007 Posts: 1075 Topics: 7 Location: At Home
|
Posted: Mon Jul 26, 2010 1:50 am Post subject: |
|
|
Why use = ??? Surely just quoting the text is enough? _________________ Utility and Program control cards are NOT, repeat NOT, JCL. |
|
Back to top |
|
|
Anuj Dhawan Intermediate
Joined: 19 Jul 2007 Posts: 298 Topics: 7 Location: Mumbai,India
|
Posted: Mon Jul 26, 2010 4:31 am Post subject: |
|
|
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 |
|
|
santi.sworup Beginner
Joined: 24 Jul 2010 Posts: 3 Topics: 2
|
Posted: Tue Jul 27, 2010 7:50 am Post subject: |
|
|
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 |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12375 Topics: 75 Location: San Jose
|
Posted: Tue Jul 27, 2010 10:22 am Post subject: |
|
|
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 |
|
|
Franko Beginner
Joined: 04 Feb 2010 Posts: 8 Topics: 0 Location: Kansas City
|
Posted: Tue Jul 27, 2010 12:18 pm Post subject: |
|
|
Try formatting the entire column: 1) Format cells, 2) Custom, 3) 000000. This should provide the leading zeros you require. |
|
Back to top |
|
|
Anuj Dhawan Intermediate
Joined: 19 Jul 2007 Posts: 298 Topics: 7 Location: Mumbai,India
|
Posted: Wed Jul 28, 2010 12:08 am Post subject: |
|
|
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 |
|
|
misi01 Advanced
Joined: 02 Dec 2002 Posts: 629 Topics: 176 Location: Stockholm, Sweden
|
Posted: Thu Aug 12, 2010 3:53 am Post subject: |
|
|
... or simply try appending one single quote in front of the numeric values whose leading zeroes you want to retain |
|
Back to top |
|
|
Cogito-Ergo-Sum Advanced
Joined: 15 Dec 2002 Posts: 637 Topics: 43 Location: Bengaluru, INDIA
|
Posted: Mon Aug 23, 2010 10:56 am Post subject: Re: Loosing leading Zeros in Excel file from mainframe(Cobol |
|
|
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 |
|
|
misi01 Advanced
Joined: 02 Dec 2002 Posts: 629 Topics: 176 Location: Stockholm, Sweden
|
Posted: Sat Aug 28, 2010 2:51 am Post subject: |
|
|
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 |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12375 Topics: 75 Location: San Jose
|
|
Back to top |
|
|
misi01 Advanced
Joined: 02 Dec 2002 Posts: 629 Topics: 176 Location: Stockholm, Sweden
|
Posted: Sun Aug 29, 2010 2:03 am Post subject: |
|
|
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 |
|
|
Crox Beginner
Joined: 29 May 2004 Posts: 52 Topics: 9
|
Posted: Mon Aug 30, 2010 11:40 am Post subject: |
|
|
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 |
|
|
|
|