Re: 4GL Question
Posted in 1999
On Mon, 8 Feb 1999, Bob wrote: > I am working on a Year 2000 problem. I have many .per and many .4gl > to work with. I am trying not to have to modify the 4gls if possible. > > The question is how can I force the user to enter a 4 digit year in a > type date field, while also giving them the ability to enter or change > the value to a NULL? All these forms are being accessed from 4gls and > are not ISQL Perform screens run from the Perform menu. > > Database 7.2x -- 4GL 6.0 You can't. Your nearest approach would be a picture field, but even that would not stop them leaving two of the year digits as blanks. And, what's more, you really don't want to make your users have to do more typing than they have to. So, you ensure that the forms display all four digits for the year, and you upgrade to 7.2 I4GL so that you can set DBCENTURY and have the I4GL code add an appropriate century to any 2 digit years the users enter. For most purposes, DBCENTURY=C is the best value to choose; it gives you a sliding window 50 years forwards, 50 years backwards, for any 2-digit years which are entered. Since your code displays all 4 digits, if the 2-digit year is misinterpreted, the user can fix it. Your code can also validate that any given field is plausible; dates of birth 50 years in the future are notoriously unreliable (heck, dates of birth 5 days in the future aren't reliable!). Retirement dates 50 years in the past are seldom relevant. You can do this sort of validation via check constraints on the tables, or by modifying the form files, or (perhaps) via UPSCOL. Yours, Jonathan Leffler (jleffler@informix.com) #include <wish/I/was/skiing.h> Guardian of DBD::Informix v0.60 (v0.61_02) -- http://www.perl.com/CPAN Informix IDN for D4GL & Linux -- http://www.informix.com/idn