× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Rick;

As Vern said, DBU is passing blanks as the value of the field, not null thus the DDL default clause is not invoked, an RPG write would have the same problem. If you wrote to a LF or index that did not contain the field in the record format the default value would be used.

In a quick test DBU populated the default value into a defaulted field on the add display.

For an RPG write another possibility would be to allow the defaulted field to contain null and set the null indicator before the write. I would expect this to work but I have not tested it.

As to the SYSTEM_USER SESSION_USER issue, the 6.1 sql reference does not allow them in the default clause:
default-clause

.-WITH-.
|--+------+--DEFAULT--+-------------------------------------------------+--|
+-constant----------------------------------------+
+-USER--------------------------------------------+
+-NULL--------------------------------------------+
+-CURRENT_DATE------------------------------------+
+-CURRENT_TIME------------------------------------+
+-CURRENT_TIMESTAMP-------------------------------+
'-cast-function-name--(--+-constant----------+--)-'
+-USER--------------+
+-CURRENT_DATE------+
+-CURRENT_TIME------+
'-CURRENT_TIMESTAMP-'


Duane Christen


--


Duane Christen
Senior Software Engineer
(319) 790-7162
Duane.Christen@xxxxxxxxxx

Visit PAETEC.COM


-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx [mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of Vern Hamberg
Sent: Monday, May 18, 2009 8:12 AM
To: Midrange Systems Technical Discussion
Subject: Re: Default user ID in SQL table

Can answer one question - a blank field is a field WITH a value - all blanks. A field without a value - I assume you mean one that is NULL - could have anything in memory or on disk, but it has a flag that says we do not know what its value is. Also, this is a different usage of the word, null, than it is when applied to pointers.

Regards
Vern

Rick.Chevalier@xxxxxxxxxxxxxxx wrote:
I can see that I didn't phrase my original question correctly. Maybe Duane has the right answer but I'm going to try this one more time to see if there are any other thoughts.

I really am only interested in the field values on add. I asked the change question already. What I want to know is, I think, really two parts.

Part one is why don't I get the default values when adding records using DBU? Duane's answer does make sense; I just thought a blank alpha field is the same as not having a value. Maybe not.

Part 2 is why do I get errors when replacing the USER special register with SYSTEM_USER or SESSION_USER? The SQL reference seems to say they are pretty much the same thing. Using SYSTEM_USER or SESSION_USER in place of USER results in a 'token not valid' error on the comma ending the line.

Hopefully this will clear things up some.

Rick

Privileged and Confidential. This e-mail, and any attachments there to, is intended only for use by the addressee(s) named herein and may contain privileged or confidential information. If you have received this e-mail in error, please notify me immediately by a return e-mail and delete this e-mail. You are hereby notified that any dissemination, distribution or copying of this e-mail and/or any attachments thereto, is strictly prohibited.

--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list To post a message email: MIDRANGE-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at http://archive.midrange.com/midrange-l.


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

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.