|
I disagree...
NULL can be very useful. But, it's often overused and/or misused.
Consider NULL when it has different meaning than a type default (0,
blank/empty, 9999-12-31/0001-01-01)
For example, a column for "Address line 2" is often "optional"; a user may
or may not enter it. But does my application really need to differentiate
between "not entered" and "entered blanks"? Probably not.
Consider "Expiration date", "never expires" is a valid choice. NULL might
used for that. But from a business standpoint, it's probably easier to
simply "never expires" isn't allowed. Instead, we'll allow an expiration
date of 9999-12-31; that's close enough to "never" for most people. Now
perhaps we can use NULL to mean "unknown" - and we need to find out what
that actual expiration should be.
In the Op's case, he needs to differentiate between entered 0 and not
entered. Allow NULL is a reasonable solution. His alternatives
1) Flag field (is just an application defined null-bit)
2) Magic Number, -1 perhaps. Since I suspect the "valid" values for this
field are >= 0. But now instead of checking for NULL, you're checking for
-1.
3) Storing the column as a NOT NULL in it's own table.
Option 3 is usually branded about as a way around allowing NULL in the DB.
But from an application/UI standpoint you still have to deal with NULL
since a record may or may not exist.
NULL isn't really the problem here, it's the limits of the 5250 UI.
The BLANKS keyword I suggested is a possible solution...
Charles
On Wed, Feb 22, 2017 at 8:35 AM, Henrik Rützou <hr@xxxxxxxxxxxx> wrote:
DB null capable fields is something the devil has created to make life
miserable for programmers!
On Wed, Feb 22, 2017 at 4:07 PM, Raul A Jager W <raul@xxxxxxxxxx> wrote:
You need to show only or also read?null.
Will blank mean null and zero the value zero? To display you can use
%editc() to move to a char field if not null, and clear the field if
You need to validate only if you need to read the field.well
On 02/21/2017 06:17 PM, Bob Cagle wrote:
Is there a way to display a null value on a display file? I have a user
requesting that a 2-digit numeric field show either blanks or zero as
as 1 - 99, emulating Excel-like behavior.-- Este e-mail fue enviado desde el Mail Server del diario ABC Color --
The only solution I can think of is to convert it to a character field
and validate for numeric or blank. Suggestions?
Thanks
Bob Cagle
IT Manager
Lynk
-- Verificado por Anti-Virus Corporativo Symantec --
--
This is the RPG programming on the IBM i (AS/400 and iSeries) (RPG400-L)
mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.
Please contact support@xxxxxxxxxxxx for any subscription related
questions.
Help support midrange.com by shopping at amazon.com with our affiliate
link: http://amzn.to/2dEadiD
--
Regards,
Henrik Rützou
http://powerEXT.com <http://powerext.com/>
--
This is the RPG programming on the IBM i (AS/400 and iSeries) (RPG400-L)
mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.
Please contact support@xxxxxxxxxxxx for any subscription related
questions.
Help support midrange.com by shopping at amazon.com with our affiliate
link: http://amzn.to/2dEadiD
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.