Thanks for subscribing to the PowerBASIC Gazette CyberEdition. It's free to all who ask, and we'll publish on a frequent basis. We'll bring you programming tips, special software offers, sample code for PowerBASIC, articles, and reviews... every bit absolutely free! ==================================================================== PowerBASIC and Y2K ------------------ by Dave Navarro - PowerBASIC Inc. Now that the holiday season is a fond memory, our thoughts drift to this time next year. Many will worry more about how their systems respond than the latest toy fad (what is a Furby, anyway?). Just what is this "Year 2000" problem we've heard so much about? Why is it such a big deal, anyway? The problem stems from the limitations of computers over the past 20 or so years. Remember when a ten megabyte hard drive was standard? And 640k was all the memory you could fit in your computer? Because of the limited amount of data that could be stored (compared to today), programmers used all kinds of tricks to limit the size of their programs and the size of the data files they created. One of those tricks was to store the date using a two digit year. We all know that 11/20/85 means November 20th, 1985. So we can save two bytes by using only the last two digits of the date. Multiplied by hundreds of thousands or millions of data records, we save a lot of storage space. Now, when a program needs to manipulate a date, it's simply a matter of subtracting one date (11/20/84) from a second date (11/20/85) to get the difference. In this case, precisely one year. But what if the second date is the year 2000 or beyond? What happens when we subtract the first date (11/20/84) from the second date (11/20/00)? 0 - 84 = -84 Or, eighty-four years difference, not six years. Imagine getting an electrical bill for 84 years of service. A bit shocking? Likely. What about my PowerBASIC programs? Until very recently, the Basic language never offered much support in the way of dates. Using the DATE$ system variable you could get the current date, or change the computers date. All versions of Basic, including GW-Basic, BasicA, QuickBasic and PowerBASIC return the current date using all four digits for the century. If today were December 7th, 1998, then DATE$ would return the string value "12-07-1998". Clearly this would not cause any Year 2000 problems. Unless of course, your code truncated that to "12-07-98". Then your code may have a very serious problem. The only potential "bug" in the Basic language may occur when you change the system date using the DATE$ variable: DATE$ = "12/07/03" Generally speaking, your program shouldn't change the system date. But for years, some programmers have used a subtle trick to obtain the day of the week for some specific past or future date. It is possible to call a DOS interrupt which returns the current system date, and the current day of the week. Rather than calculate the information themselves, some have found it more convenient to cheat just a bit. They change the system date for a brief moment, get the day of the week for that date, then change it back: CurrentDate$ = DATE$ DATE$ = "12/07/03" DayOfWeek = Int21Call DATE$ = CurrentDate$ In GW-Basic, QuickBasic, and early versions of PowerBASIC, this would change the date to December 7th, 1903, not December 7th, 2003. So the day of the week would be returned incorrectly. Actually, an attempt to set the system date to any value earlier than 1980 (on most computers) would result in a run-time error that would crash your program. However, some operating systems, such as Windows NT, *will* let you set the system date to earlier than 1980. If your program is running on Windows NT, the above code could result in severe calculation errors. So what can I do? If your program doesn't use the above trick to change the system date, you'll have no Year 2000 problems related directly to the Basic language. But, that offers no assurance about the rest of your source code. It could still be littered with problems caused by truncating a year number to just two digits. If your program has been compiled in PowerBASIC 3.2 or earlier, and you are using the above trick, you can simply re-compile the code in PowerBASIC 3.5. In version 3.5 (and our current Windows compilers), any two digit date earlier than 80 is assumed to be based upon the year 2000, while any two digit date of 80 and above is assumed to be based upon the year 1900. This is generally accepted as a practical solution to the year 2000 problem. Will re-compiling fix my code problems? No. PowerBASIC will only compile the source code you give it. It never modifies your code in any fashion, so it doesn't look for year 2000 problems in your code. If you've written PowerBASIC source code which is not Y2K compliant, you'll need to find and fix any problems in that code yourself. All current versions of PowerBASIC products, including PB/DOS 3.5, PB/DLL 2.0, PB/DLL 5.0, PB/CC 1.0, QuickPak/Pro and PB/Vision are year 2000 compliant, using the above mentioned technique for two digit years. For up-to-date information on Year 2000 issues with PowerBASIC products, please visit and bookmark the PowerBASIC Y2K page at http://www.powerbasic.com/year2000/ ==================================================================== Order online at https://www.powerbasic.com/shop/ Most PowerBASIC products (those without printed books) can now be delivered by electronic mail. No wait for a package to arrive... No high shipping costs... For just $6 per order, no matter how many products, we'll deliver directly to your computer. If you're outside the U.S., savings might be greater. You won't pay taxes or duties to a freight company or postal service, because they aren't involved in the delivery. Check your tax code to be sure, but some countries charge no tax at all on transactions of this type. It could just be your lucky day! ==================================================================== Is your PowerBASIC Gazette Electronic Edition subscription coming to you at home or work? If you don't want to miss a single issue, why not subscribe from both email addresses? Send your subscription request to email@powerbasic.com and please include your name and all email addresses you'd like to add as well as your Zip or Postal Code. If you know someone else who would enjoy this newsletter please forward a copy to them so they can subscribe. ==================================================================== All contents Copyright (c) 1999 PowerBASIC, Inc. All Rights Reserved. PowerBASIC is a registered trademark of PowerBASIC, Inc. PB/CC, PB/DLL, and PowerTREE are trademarks of PowerBASIC, Inc. All other brand names are trademarks or registered trademarks of their respective owners. ==================================================================== PowerBASIC Gazette - Electronic Edition Volume 1 - Issue 7 PowerBASIC, Inc. (800) 780-7707 Sales 1978 Tamiami Trail S. #200 (941) 408-8700 Voice Venice, FL 34293-5006 (941) 408-8820 Fax Visit us on the World Wide Web at http://www.powerbasic.com Email Sales: sales@powerbasic.com This newsletter is only sent to email addresses in our subscription list. If you have received this newsletter by mistake or no longer wish to receive it, please send a simple unsubscribe request to support@powerbasic.com with your name and zip/postal code. This newsletter is best viewed with a fixed-width font. ====================================================================