× 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.



On 20-Apr-2016 15:59 -0500, CRPence wrote:
On 20-Apr-2016 15:34 -0500, David Gibbs wrote:
On 4/20/2016 3:20 PM, Rob Berendt wrote:
In general, anything that changes the length or position of any
fields in the record format used by the program requires that
the program be recompiled.

Yep, that's what I thought too ... but it appears a columns
default value effects it too.

I created a test table with the following SQL:

CREATE TABLE DEVDMGWRK/TEST1
( FIELD1 CHAR ( 10) NOT NULL WITH DEFAULT 'ABC'
, FIELD2 CHAR ( 10) NOT NULL WITH DEFAULT
)

The format level identifier on the table is '1E0C965CBDD7E'.

I then dropped the default from FIELD1

ALTER TABLE DEVDMGWRK/TEST1 ALTER COLUMN FIELD1 DROP default

Now the format level identifier is '1E0C9664BDD7E'.

It seems to me that the default value of a field should have
nothing to do with the format of the file, just its contents.


A different default value is not the change being reflected in the
hash by that column attribute change via ALTER [or as seen instead
via two separate CREATE requests]. The *lack of a default* for that
field was reflected in that change of the hash; i.e. an INSERT is
henceforth disallowed on the field FIELD1 after the DROP DEFAULT,
versus merely having changed the default from a specific literal to
the data-type default.

In effect, that ALTER to the column will have modified the
_equivalent_ DDL CREATE to this:

CREATE TABLE DEVDMGWRK/TEST1
( FIELD1 CHAR ( 10) NOT NULL
, FIELD2 CHAR ( 10) NOT NULL WITH DEFAULT
)

Notably different than what the _unchanged_ RcdFmt LvlID would have
been, if the effect of the ALTER were instead:

CREATE TABLE DEVDMGWRK/TEST1
( FIELD1 CHAR ( 10) NOT NULL WITH DEFAULT
, FIELD2 CHAR ( 10) NOT NULL WITH DEFAULT
)


I should have mentioned, if the desire was merely to change the DFT value, then the ALTER COLUMN should be SET DATA TYPE *instead of* the DROP DEFAULT that was coded originally:

ALTER TABLE DEVDMGWRK/TEST1
ALTER COLUMN FIELD1
SET DATA TYPE CHAR(10) NOT NULL WITH DEFAULT

And FWiW: A snippet from [http://archive.midrange.com/rpg400-l/201201/msg00286.html] with an updated doc link\navigation as redaction:
"... A doc reference which describes most of what is and what is not included in the hash:
[http://www.ibm.com/support/knowledgecenter/ssw_ibm_i_73/dbp/rbafoecffd.htm]
IBM i 7.3->Database->Programming>Database programming->Managing database files->Changing database file descriptions and attributes->Effects of changing fields in a file description
..."


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.