Post #138,353
1/28/04 2:23:43 PM
|
XML
Goal: Seamlessly convert MF generated COBOL reports into XML data which can then be imported into Excel 2003. Given a bunch of report files. Each line on the report maps to a COBOL layout. Each COBOL layout can be used to parse out the line. There will be enough info on the line to match the particular layout. There will be a variety of headers, footers, sub-totals, and a variety of data lines. Does XML conversion make sense in this context? Given this simple report: \nGeneral Report\n\nTitle Qty Cost\n--------------\naaa 23 $25\nbbb 20 $30\nccc 21 $20\nddd 23 $ 5\n--------------\nTotal $80\n\nDifferent Set of data in same report.\n\nTitle Loss\n-----------\nqqq 29\nxxx 60\n\n\n Does it even make sense to put it in XML to place it in Excel? I could put it directly in Excel. Why use the XML? Other than the fact my boss told me to. Can someone point me to a decent online tutorial since I can't even figure out how to correctly handle the main title or total lines.
|
Post #138,354
1/28/04 2:32:21 PM
|
XML
Your boss is an idiot. Use delimited text.
There is probably a utility somewhere that converts delimited text to XML. Lo, there it lies, XML::Aggregator in Perl.
XML is a ridiculous fad sponsored mostly by Microsoft to invent new proprietary confusing formats, and Sun to ensure that E10000 clusters will be under everyone's desk.
O'Reilly xml.com
-drl
|
Post #138,355
1/28/04 2:35:04 PM
|
You're kidding, right?
CSV.
XML just for Excel? Gak.
Regards,
-scott anderson
"Welcome to Rivendell, Mr. Anderson..."
|
Post #138,356
1/28/04 2:38:46 PM
1/28/04 2:39:42 PM
|
Whaddya mean, it's a growth industry!
[link|http://www.softsilver.com/|http://www.softsilver.com/]
Innovation at its finest.
Love the typo: "Aimed at none technical users!"
-drl
Edited by deSitter
Jan. 28, 2004, 02:39:42 PM EST
|
Post #138,402
1/28/04 5:51:50 PM
|
English as a 3rd language?
I dunno, ask Peter if it is correct usage over there.
|
Post #138,476
1/29/04 2:38:29 AM
|
No, it's a typo.
Renders the sentence nonsensical.
Peter [link|http://www.debian.org|Shill For Hire] [link|http://www.kuro5hin.org|There is no K5 Cabal] [link|http://guildenstern.dyndns.org|Home Page - Now with added Zing!]
|
Post #138,364
1/28/04 3:03:00 PM
|
Is the data really tabular?
If you are looking for one report to one file, but the reports have different number of columns in different sections, then CSV can't handle it. Excel can by having multiple sheets, but you'll have to think about the problem a little. I have no idea whether you can write an XML file that Excel will load into multiple sheets. (Easiest way to find out, get Excel and try to dump a file with multiple sheets into XML format. Then study what it dumped.)
As for XML in the middle, that choice doesn't make much sense to me. Do you have any ideas why your boss is insisting on that?
Cheers, Ben
"good ideas and bad code build communities, the other three combinations do not" - [link|http://archives.real-time.com/pipermail/cocoon-devel/2000-October/003023.html|Stefano Mazzocchi]
|
Post #138,368
1/28/04 3:07:31 PM
|
Re: Is the data really tabular?
Use your imagination. It's a fad, and he's a boss. It's arbitrary. Science Diet for PHBs.
-drl
|
Post #138,526
1/29/04 10:48:09 AM
|
No harm in being generous
While that is likely, it is always possible that there is something that the boss thinks of as a real reason. For instance the boss knows that another project coming down the pipeline involves lots of XML, or the person who is slated to take over maintainance may have that skillset.
No harm in asking.
Cheers, Ben
"good ideas and bad code build communities, the other three combinations do not" - [link|http://archives.real-time.com/pipermail/cocoon-devel/2000-October/003023.html|Stefano Mazzocchi]
|
Post #138,384
1/28/04 4:26:13 PM
|
Tab-delimited text file, named [whatever].XLS
Really, that's the way to create an "Excel" file by SIMPLE text-processing: Write it out as an ordinary text file, separate cells by inserting a tab (ASCII#9) character as a delimiter, and give it a file extension of ".XLS". When you open the file, Excel will apparently realise that it isn't *really* an Excel file, but will convert it on-the-fly (it appears, since it talked about it being a delimited text file and asked if I wanted to save in that format, when I was closing it). But to (File) Explorer and Windows in general, it will look like it is an Excel file; it'll have the little "XL" icon and Excel will be used by default to open it, and so on. Only trouble is, you can't use any formatting at all; never mind fancy fonts and borders and shit, but it's sometimes useful when you want strings of digits treated as text and not numbers... But, OTOH, it even recognizes and calculates formulas! Here, for example, copy and paste this into NotePad and save it as <whatever>.XLS: 1\t2\t3\t\n11\t21\t\t\n31\t32\t33\t34\n41\t42\t\t\n51\t52\t53\t\n\t=SUM(B1:B5)\t=AVERAGE(C1:C5) There -- didn't you get 149 and 29,666...? This is the way to go, Barry. Worst case, tell your boss it's a new kind of ultra-XML -- not quite invisible, but only very sophisticated and intelligent people can see it... HTH!
[link|mailto:MyUserId@MyISP.CountryCode|Christian R. Conrad] (I live in Finland, and my e-mail in-box is at the Saunalahti company.)
You know you're doing good work when you get flamed by an idiot. -- [link|http://www.theregister.co.uk/content/35/34218.html|Andrew Wittbrodt]
|
Post #138,530
1/29/04 10:51:30 AM
|
I'll have to remember that trick
I didn't know that you could put formulas in tab-delimited files.
Cheers, Ben
"good ideas and bad code build communities, the other three combinations do not" - [link|http://archives.real-time.com/pipermail/cocoon-devel/2000-October/003023.html|Stefano Mazzocchi]
|
Post #138,538
1/29/04 11:11:03 AM
|
OTOH, the on-the-fly opening isn't consistent. :-(
Double-clicking tab-".xls" file in the Explorer shell, Excel just opened it, no questions asked.
But selecting the same file from the File Open dialog, or the recently-used entry in the File menu, it threw up the "convert a delimited file" dialog.
Don't ask me why; *fuuuck* knows. Microsoft programming... :-(
(This is in Finnish Excel 2K on English Win 2K.)
Also, BTW, saving the file via the "original file format, yes I know it might lose some formatting, no I don't mind, YES dammit replace the old version!" option, it writes out the *results* of formulas; to get them as formulas, you have to explicitly save those from NotePad, I found.
Oh, and if you use a foreign-language version of Excel, it will protest "#NAME?" if you paste in the actual formula text from Excel -- you have to translate stuff like "=SUMMA(B1:B5)" and "=KESKIARVO(C1:C5)" into English! (Which still beats the way it was under Excel 95, when Microsoft had gone too far in localising it, so actual *real* .xls files saved formulas in local-language -- with the consequence that the file was useless when opened in an English [or any other different-language than the original] copy of Excel. :-)
[link|mailto:MyUserId@MyISP.CountryCode|Christian R. Conrad] (I live in Finland, and my e-mail in-box is at the Saunalahti company.)
You know you're doing good work when you get flamed by an idiot. -- [link|http://www.theregister.co.uk/content/35/34218.html|Andrew Wittbrodt]
|
Post #138,574
1/29/04 12:31:32 PM
|
My brain hurts thinking about how you know all of that...
|
Post #138,576
1/29/04 12:36:58 PM
|
ICLRPD
My brain hurts thinking about how you know all of that.. Either there's just lots today, or I'm finding things abnormally humorus :)
----- Steve
|
Post #138,594
1/29/04 1:12:09 PM
|
Just a quick trial, yesterday. 5 rows typed + 8 mouse clicks
|
Post #141,231
2/11/04 6:04:15 PM
|
ICLRPD! (new thread)
Created as new thread #141230 titled [link|/forums/render/content/show?contentid=141230|ICLRPD!]
jb4 shrub\ufffdbish (Am., from shrub + rubbish, after the derisive name for America's 43 president; 2003) n. 1. a form of nonsensical political doubletalk wherein the speaker attempts to defend the indefensible by lying, obfuscation, or otherwise misstating that facts; GIBBERISH. 2. any of a collection of utterances from America's putative 43rd president. cf. BULLSHIT
|
Post #138,401
1/28/04 5:49:41 PM
|
Thanks for the reality check
#1 The data is not truly tabular. There can be many different layouts in a single report, skewing all over the place. Then add in a bunch of subtotal, average, and other info lines, and none of it will ever line up.
#2 There are hundreds of these reports, and they change all the time. The only way to KNOW what is in them is to parse the COBOL layout, and there might be a dozen layouts per report.
We will setup a standard for the COBOL programmers to add an identifier AFTER the end of the normal printed record. This way they can use the same layout to generate both reports, except when it gets printed the identifier will never show up. This way I know EXACTLY which of the 100s of possible layouts that particular line came from so I know how to parse it.
Ever write code to parse COBOL layouts? COBOL is a COMPLEX language if people really use it to it's fullest extent. But print layouts are simple, no implied decimal, no binary, no redefines, no occurs, so it only took me about 30 minutes for this parser.
#3 My boss knows that I can generate them directly in Perl, including tagging numbers VS zipcodes VS text VS $$ amounts, setting up the proper justification, comma-izing, etc. He was a Perl programmer before his brain started to atrophe. In this case, he thought it would be a good idea for me to play with XML, learn a bit, and then make up my own mind how to do it.
With this data delimited of any type does not work for me since I need to juggle data types constantly.
Spreadsheet::WriteExcel and Spreadsheet::WriteExcel::Utility are your friends.
If I generate the additional XML based data later, it will add to our buzzword compliance, which is always a "GOOD THING (tm)"
|
Post #138,492
1/29/04 9:22:54 AM
|
is a confidence game pushed by the web designer non-techies
Beware the leader who beats the drums of war in order to whip the citizenry into a patriotic fervor, for patriotism is indeed a double-edged sword. It both emboldens the blood, just as it narrows the mind. And when the drums of war have reached a fever pitch and the blood boils and hate and the mind has closed, the leader will have no need in seizing the rights of the citizenry. Rather, the citizenry, infused with fear and blinded by patriotism, will offer up all of their rights unto the leader and gladly so. How do I know? For this is what I have done. And I am Caesar."
- Julius Caesar
|