- Feature Articles
- CodeSOD
- Error'd
- Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
IN THE YEAR... TWO THOUSAND... IN THE YEAR... TWO THOUSAAAAAND
Admin
If you want to implement fixed-width records to contain potentially unlimited data, you set up an index field at the start so as to allow multiple records to hold your data. So, for example, index 1 fields 1 to 50 contains the first 50 characters of the first name, index 2 fields 1 to 50 contains the second 50 characters, etc. etc. Then there is no need to truncate -- but at the expense of an inefficient use of space.
Admin
Admin
Although in this day and age, you will probably not live to see the 2020s if you don't migrate, at least not if customer data is involved.
Admin
TRWTF is PC programmers who can allow themselves to believe that a multi-million dollar operating system can't handle anything except US-English. When DB2 needs to store Finnish names, it assigns CCSID(278). UTF-8 is CCSID(1208).
Now get off my lawn!
Admin
(About the author: No, I don't live in Hawaii. I've spent a grand total of two weeks there in my life. One of those two weeks was the 9th to 16th of September 2001 (yes, that made leaving the place interesting), the other two years earlier. But I have a medium-weight interest in human linguistics.)
Admin
Admin
Admin
Think address label printing. One record, one label. Print characters directly from the record, no fuss. With chained records, you will have to assemble the strings to be printed from the multiple records before you print. If that is possible at all and the label printer itself does not also expect a fixed width 2000 character record.
CAPTCHA dolor - It must be a dolor in the ... to work with such a system.
Admin
Looks like .Net handles EBCDIC conversion if you don't want to do it on the COBOL side:
http://stackoverflow.com/questions/2858202/how-to-convert-from-ebcdic-to-ascii-in-c-net
So with that and an array of field lenghts I don't see why this should take more than 15mins.
Admin
(Another reason to promote COBOL on wheelchair!)
Admin
TRWTF is all the developers and programmers who say COBOL is "crippled" and should be replaced without understanding what it is or what it does because all they know is "cool shit" and how to count in 42 languages. They have no idea about "real world" use of computer systems and data processing. I would rather have my banking and payroll run in a 40 year old COBOL environment than to deal with some "cool shit" solution that gets updated every 10 minutes by two guys who have never had a date and haven't showered in 3 months that are more concerned with the XBox-Playstation debate than writing a program that works or with a "drag and drop" automatic web application that starts with no programming and ends with "I dunno... let's reboot and see if that fixes it"
It's not that COBOL can't handle variable width data. Instead, it was designed with the ability to view a flat data file as a database table BEFORE databases existed. COBOL reads an entire row -- not fields -- from the data file and assigns variables according to the fixed-width directives which define the variable fields. It can also can do things like zero pad numbers so there's none of that "if (ZIP < 10000)..." crap.
The real trouble with adding an email field to the mess in this article or to expanding the width of the field (remember the Y2K fiasco?) is two fold: 1- EACH AND EVERY PROGRAM that looks at the file MUST be recoded so as to redefine the data structure and then recompiled, but this can be made easier with the proper use of COPYBOOKs (yes, there is 'improper' use and it can leave you worse off than not using them at all); 2- EACH AND EVERY FILE must be converted by selecting all data into wider fields in a new table or file. Eaasy enough to do with a database table, but if you're using EBCDIC you have to also write a program to convert records from one file format to another while making sure to handle all the padding and othe conversion and then repeat this for all the files you need to modify and THEN you need to be sure to go through your entire code base to make sure that all your "if (ZIP < 10000)" type workarounds and all your date calculations will work correctly with the new files.
Now turn off your Xbox and go take a shower!
Admin
This may well be the WORST 'history lesson' about computer languages EVER.
This first paragraph is the real WTF of this story.
Admin
Yes, and then I spend those 15 minutes writing my resignation letter.
Admin
Admin
Yep i once had to write a parser for such a mainframe data file. First an indicator byte to signal which record type / combination of variables to expect and then the still fixed-width variables (strings padded with blanks). Even XML looks slim in comparison!
Uh, what? Besides: A ZIP is an identifier, not a number! Why-the-fuck to you want to treat an identifier as a number? You use numbers if you need to perform calculations on them, otherwise use another data type! And that is not a very strong indicator of a crippled language and data format?As a Webservice is the topic of the article: A webservice is based on XML, and this means the schema is not hardcoded but defined in a separate file, where it can be changed centrally. If you made hardcoded assumptions about the schema that means either your program is a WTF or you were forced to do it because your programming language is crippled!
Admin
Admin
What if X=1 ?
Admin
Whilst your ZIP example conforms to this rule, not everything does. Autonumber ID fields are identifiers and almost never need any kind of math or calculation performed on them; this does not make them a good fit for being persisted as a string.
We have DBAs here who constantly complain that our 4-digit site identifiers should all be varchar(4) instead of smallint. Problem is, most of our primary keys are entirely or partially made up of the store number column, and would double in size if they were to be converted to 4 characters instead of 2 bytes. On a table with millions of rows, suddenly the dogmatic view of "it's a name not a number make it a string lol!1" doesn't seem like quite such a bright idea.
Admin
snoofle, the word "intact" is not hyphenated.
Admin
This.
Also, since it seems I was too vague in my previous posts, I wasn't specifically talking about the example in the article when I wrote about people who think it's a good idea to truncate data. But even nowadays, with modern applications (and by "modern" I mean that they aren't legacy applications that have been migrated, but something that was developed in this century), some people think it's a good idea to truncate data. But then again, "some people" are just stupid. ;)
Admin
Admin
TheDailyWTF.com has officially run out of source material.
Admin
Are you saying the wtf is that software technology over 40 years old exists, and while powerful, it's not quite as versatile as other similar technologies developed with the benefit of 40 years experience?
Because that's like saying a caveman armed with an axe is a WTF, because he hasn't hit the nearby neanderthal village with napalm.
Or are you saying that the wtf is that some companies have existing systems that work really well, but because of changing times they want to add some extra functionality without breaking the old systems that work really well?
Because "if it ain't broke, don't fix it" is probably a principle that we should all adhere to.
Admin
Ever written a system? Was it used for very long?
Six months from now, your new system is now a legacy system.
Legacy systems are how we got to where we are. It has been a long time since we could do without computer systems.
That stated, systems should be updated over time.
Sincerely,
Gene Wirchenko
Admin
Another is that there is a limit to the number of times that duct tape and its friends is a good solution. Technical debt and all that.
Sincerely,
Gene Wirchenko
Admin
What if X=-1?
Do I get math/science awards for finding a negative length?
Admin
For ZIP codes, it is pretty easy: use longs (there are zip codes greater than 65536), and then "%05ld".
As for COBOL: There is the story of the COBOL programmer who didn't want to be caught up in the Y2K whirlwind, so he enlisted a company to put him in suspended animation for a few years in 1998. Turns out they forgot about him, and when he woke up, he asked "Has the Y2K problem been solved?", to which they responded: "Yes, that was long ago. We woke you up when we realized you were a COBOL programmer. You see we have this problem with 4 digit dates and thought you might be able to solve it". He then asked: "What year is it?". The reply was "Oh, 9998. We have two years to get this working.".
Yes friends, COBOL will be around long after we have all figured out that 2100 is NOT a leap year.
p.s. Don't use floating points for money. It doesn't work!
Admin
Cobol is of course alive and well. Take a look at this wtf article: http://thedailywtf.com/Articles/No_Need_to_Change_It!_.aspx
Admin
'85? Newfangled... I coded '77 Cobol. WATBOL, to be precise.
Admin
Admin
It's even crazier than that. In two dimensions, the side of the square is a null set, so it has measure zero. This means the side of the square fits infinite times inside the square. You will never be able to fill the square with sides.
Admin
But in that case X^2 is not > X. It's the same.
Admin
Admin
You're missing something essential about measure and integration. In particular, null sets are "closed under countable addition". But in a hand-wavy sort of way, you can view integration as summation over an uncountable index. Countable addition does not apply. This is kind of the point of integration, and is the reason why we have measure theory, non-standard analysis, etc.
Admin
Yeah, I flew PVD to AUS on the 26th, and it was still pretty hectic then. Although not quite what my grandmother went through, attempting to fly BOS to DEN on the 11th, and ending up in BUF.
Admin
Admin
"Fixed-width is enough for all!" "And do it all with COBOL!" said Manager man who's web service plan was just a hell-bound snow ball.
Admin
If you take one of the sides and try to stick it inside the square, it just escapes out of the hole where that side was.
Admin
The WTF?
Fujitsu released COBOL.Net about 15 years ago. Creates web services quite nicely.
Admin
Admin
In my 30+ years experience in IT, the major problem with having variable-length fields is that at the end of the process there's normally a database table with fixed-length (or severely limited) columns. So you can change the web-services to allow for email addresses of 64Kb, but if the relevant database table only allows 50 bytes then you're wasting your time.
Admin
Everything on AS/400s was stored in relational-like tables. Source code was stored in tables. They had three columns: line_no decimal(6,2), source_text char(80), and date_modified decimal(6,0). (Y2K was handled by the date windowing technique: year > 39 implies century is 19.)
Maybe some mainframe programmers who were forced to port to an AS/400 created tables with a single 2000-character column, and studiously ignored all the built-in features like keys, indexes, views, ACIDity, etc. But that was not the way of the AS/400 at all.
Admin
Now, if your DBA's were insisting that the smallint be replaced by a BLOB that is a Quicktime(R) movie of someone reciting the company mission statement, and then writing the site ID on a blackboard ... then you might have a problem.
Admin
ZIP codes aren't just numbers and are not a consistent length either.
In the US, they may have a dash in them. In most of the world they are alphanumeric.
I regularly find online shopping websites that make it impossible for any US resident to enter their full ZIP or for almost any non-US citizen to enter their details at all.
If you aren't going to do maths on it, NEVER store it as a number.
But remember that ++i is maths...
Admin
Except... never saw e-mail address longer than 50 chars and maximum could be even 30.
CAPTCHA: secundum
Secundum, anyone who has e-mail address longer than 50 chars is a walking WTF himself.
Admin
COBOL was designed by woman...
Admin
Admin
Maybe you won't find many email addresses with more than 50 characters, but some services allow you to specify multiple email addresses (comma-separated) in one field, and thus send the same message to a number of recipients.
Admin