- 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
Admin
At my last place of work, we still used this format (and probably continue to after I left) as we still had interfaces using it from the old days of COBOL. It is a standard, and one I would've thought a BI person would've come across at some point. Not really a WTF.
The 2t is a WTF tho.
Admin
TRWTF is that she didn't immediately recognize signed overpunch.
Admin
TRWTF is writing code to handle the zoned overpunch. COBOL takes care of that for you if you define the variable correctly. (or is TRWTF that I know this?)
Admin
Finally got sick of the writing. Skipped to the comments after the bit about the monkeys. Glad somebody elected to educate the author.
Admin
Admin
Admin
And shame on you for missing a golden opportunity to make a "type O negative" joke.
Admin
Admin
This one made me WTF out loud. Using letters for negatives...WTF?
Admin
Now, how do you use that nice COBOL feature from within your SQR-application?
Addendum (2013-12-05 12:31): Upon second look, the code-snippet might be part of the data-exporter, not the importer.
Still it indicates an environment where COBOL is not necessarily a given.
Admin
I think the author embellished a tad. I wouldn't be surprised if it failed on the FIRST negative number, and they kept trying to change the definition of insanity by running it again and again and again, hoping for a different result.
Maybe there were N's and P's and whatnot in the sets later on, but they just got hung up on 2196O.
Captcha: ingenium... because Alicia is the ingenium star of the NSA
Admin
I ran in to this in my very first programming job in '85! I was extracting data from a time/charge billing system called, cleverly enough, TCB, sucking it in to dBase III to provide prettier invoices and better reporting. And that was exactly how they stored balances and charges. I had a subroutine and another set of columns to hold the converted data.
Fun times.
Admin
Admin
Admin
OK, since there seems to be some confusion about this....
First of all, you must understand the comcept a "packed decimal". In addition to binary integers and floating point numbers, IBM 360s (and I assume other IBM computerd of that era -- 1960s), had a data type called "packed decimal" which is essentially what we now call "binary-code decimal" (BCD).
Basically, one decimal digit is stored in one hex digit. Calculations done in packed decimal were able to maintain their precision and accuracy (even with decimals), at the cost of being slow.
Of course, "slow" is a relative term, when the alternative is doing it by hand with an adding machine, so packed decimal became the standard data type used, particularly in COBOL, but I believe also in Fortran.
One innovation of packed decimal over standard BCD is the use of an addition digit at the end, to represent the sign. Since they had 6 digits they weren't using ('A' thru 'F'), they made A,C,E,F positive, and B & D mean negative. So 01 23 4F is +1234, and 12 34 5B is -12345. Note, however, the "preferred" sign characters were C & D, so after any calculation, the sign would be changed to one of those as appropriate.
The next step is how to get that number from a punched card. Data from a card is stored in EBDCIC (EBCDIC was IBM's alternative to ASCII, because IBM had to be different). So "1234" is EBCDIC is F1 F2 F3 F4, and IBM 360s had an instruction called "PACK" which would strip the upper nybble off each byte in a block except for the last, on which it reversed the nybbles. So F1 F2 F3 F4 would become 01 23 4F (you can see now how the decimal digits are "packed" together)
This worked fine for positive numbers, but what to do about negative numbers? For those, IBM came up with a creative hack.
On punch cards, there are printed digits 0 - 9 in each column. A single punch in any of those rows would represent that digit. There was also some blank space for two more rows at the top which could also be punched (called the X & Y rows). Holes in the X and/or Y row plus a hole in a digit would represent some other letter or character. The dash (-) was just a hole in the X row.
So, to enter a negative number, you would type the number, then backspace, and over-type the last digit with a dash (minus sign). On the printing on top, it would look like a struck-thru digit, but a card reader would read the X-punch + digit-punch as a letter, specifically the letters 'J' thru 'R' which in EBCDIC are D1 thru D9, so when flipped by PACK become 1D thru 9D -- making the numbers negative.
Of course, if you are working in a medium that doesn't allow overpunching (say in a text editor on a video monitor) you'd have do the digit-to-letter translation manually.
Technically, numbers without on overpunched final digit were considered "unsigned". To force a number of be positive, you were supposed to over-punch it with the character which was just a Y-hole, which was... Ampersand (go figure).
Admin
These are literals and not quoted in English: 2 December 5, 2013
Sincerely,
Gene Wirchenko
Admin
Admin
I was taught COBOL, overpunches and all, in 1973. As punched cards were the only way of getting data into the program work-arounds like this were not uncommon.
Admin
Admin
Admin
'Zoned values with sign overpunch' was a format created for the 'binary coded decimal' 'unit record' environment, which derives from the 80-column punch card introduced in 1929. It is strongly associated with COBOL because COBOL was first developed exclusively in that environment. By 1979 it was all starting to be replaced but existing kit was not just tossed out every Xmas like it is today.
A 'big' computer was one that had 128 KB of RAM and 20 MB of disk, and ran at about 500 KHz. There was no computing power available for interacting with humans in real time. Keypunch operators created the input records manually offline, using a honking great machine like a typewriter on steroids. Every field definition was a compromise of space, time, and complexity constraints.
You need to understand that the world was not always as lacking in humor as it is now.
Admin
Other than the "2t" typo, this implementation actually jives with standard practice in the COBOL world.
http://en.wikipedia.org/wiki/Signed_overpunch
Admin
Admin
Admin
If you think about it too much, that's the only interpretation that even makes sense: Since opposition isn't actually necessary to operate a space bar with your thumbs, the monkeys' thumbs can only be missing entirely.
Admin
Admin
Gotta love BI-curious girls...
Admin
honestly, fail to see the WTF... looks like EBCDIC for a VAX or something. But yeah, always fun reading files like that one... :|
Admin
(But thanks for explaining the word-origin of "overpunch")
What has BCD to do with this? The issue at hand is encoding signed numbers in EBCDIC. The internal representation when performing calculations on them has nothing to do with this! "Maintain their precision and accuracy"? They are imprecise and inaccurate! The point of BCD is that the inaccuracy is exact the same as in calculation with numbers represented as decimals. So they are spending a digit (4 bits) where a single bit would have been enough.It seems some of those "but we had only so few memory" explanations are lousy excuses for not doing a proper job!
(Also: Fixed width data-formats, where most of the space is allocated by spaces. But still enforces limits on field lengths. Slim data formats? I don't think so!)
They even invented multiple variants of EBDCIC, because IBM had to be different from IBM.Vendor-lockin is not enough, we want our customers locked to a specific series of our product range!
So "AB+" is actually typed "171&"? Now let's encode this in XML!Admin
Admin
It has everything to do with this. It explains why this particular scheme for negative numbers was used, and why some scheme needed to be used. (If we didn't need to convert from EBCDIC to an internal representation, we could just punch "-1234")
I'm not sure what point you are trying to make here. The result of adding BCD numbers is accurate. It does maintain precision. You may choose to limit precision to a certain number of digit (actually you had to) but how many was up to you. Saying "inaccuracy is exact the same as in calculation with numbers represented as decimals." is merely citing the definition of the term "precision". True, but remember, bits are doled out 8 at a time, so even if you limited the sign to one bit, the other three were going to go to waste.And now we have Apple for that.
Admin
And I'll bet they all appeared in Captcha texts too.
So fill me in on a piece of unexplained jargon. Is a BI system one that goes both ways?
Admin
They go Male, Female, and File Not Found.
Admin
2t is definitely signed overpunch for ±26
Addendum (2013-12-05 15:18): Therefore:
2O == 2t 2F == 2t 2O != 2F
Admin
Admin
Just to set you straight, the Byzantine Empire didn't build labyrinths. We get the adjective "Byzantine" in its modern sense through "Byzantine politics," which were a complex web of plots and intrigues.
Admin
I ran into it for the first time not 2 weeks ago. Figured someone was trying to save a byte in the fixed-width package sent between servers which I grudgingly accepted. Then I noticed that no matter how big the actual dataset was , the network code padded the message to a multiple of 1 kb packages, with additional padding to ensure that a record would never be split across two packages.
So, to send "ok", it would send "ok" and 998 blanks. But at least we saved the byte for signs.
Then I lost my will to live.
Admin
Who would ... but I don't even ... how is that ... What? What!?
Admin
You keep using that word. I do not think it means what you think it means.
Admin
How did Grandma come up with that system
Admin
Gramma got run over by a reindeer
Admin
Wasn't there machines were an int was 36 bit?
Admin
Aren't Bits and Bytes a breakfast cereal? Or is that Gramma's bedtime medicine?
Admin
Oh, then I'll take "Self acclaimed "leading consultant" in the ETL business does not recognise widely used format" for the answer then!
Admin
Admin
"If it isn't broken, don't try to fix it" says nothing about if a clearly easier and better solution comes around. We use hammers today because while rocks worked just fine, hammers are easier and more precise and produce a better result. Rocks weren't "broke", but are clearly inferior.
Admin
Admin
Stumbled upon this case when working on data transfers between AS/400 and MSSQL a bunch of years ago. I had forgotten about that until now.
Admin
OK, I see you're wondering about James Curran's statement that bits were doled out 8 at a time. Right, when talking about packed decimal, we only need to observe 4 bits at a time. The matter of a sign nibble remains unchanged.