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



Well, I have never seen that behavior before, and we have tons of GENERATED
ALWAYS identity columns.
I must admit that there are no RPG programs in our kitchen that explicitly
try to update such columns.

A quick and dirty test shows me that RPG does not override the id value on
our system.

CREATE TABLE
ArcoTest
(
Sortcode NCHAR(16) NOT NULL DEFAULT '',
"ID" INTEGER GENERATED ALWAYS AS IDENTITY (
START WITH 1 INCREMENT BY 1
NO MINVALUE NO MAXVALUE
NO CYCLE NO ORDER
CACHE 20 )
)
RCDFMT ARCOTESTRF
;

INSERT INTO ARCOTEST (SORTCODE) VALUES ('Arco') ;
INSERT INTO ARCOTEST (SORTCODE) VALUES ('Bike') ;
INSERT INTO ARCOTEST (SORTCODE) VALUES ('Car') ;

So as a result the table contains:

SORTCODE ID
Arco 1
Bike 2
Car 3

Then the RPG:

**FREE

ctl-opt alwnull(*usrctl) ;

dcl-f arcotest qualified usage(*update) ;
dcl-ds wwRec likerec(arcotest.arcotestrf : *all);

*inlr = *on ;

clear wwRec ;
read arcotest wwRec ;
wwRec.id = 0 ;
update arcotest.arcotestrf wwRec ;

return ;

After running the program there is nothing changed in the id column.

We are at 7.3 but not current at PTF's.

Regards,
-Arco

2018-02-07 16:15 GMT+01:00 Justin Taylor <JUSTIN@xxxxxxxxxxxxx>:

I read the row and pass the whole thing to the client. The client passes
the whole row back on an update request, which I put in a data structure
(based on the table record). I do a read then update the row based on the
data structure with the client data.




-----Original Message-----
From: Rob Berendt [mailto:rob@xxxxxxxxx]
Sent: Wednesday, February 07, 2018 8:53 AM
To: Midrange Systems Technical Discussion <midrange-l@xxxxxxxxxxxx>
Subject: RE: Identity value of 0

I'm still trying to figure out why you got a zero in that column. Look at
this scenario You do your first insert. Your identity column is set to 1.
You do a READ. "ID"=1.
You do an update. It should write back out a 1.
The only way it should write out a zero (sans your rfe) is if you did a
WRITE, no READ, and then a UPDATE. Or if you cleared, or reset your values
in between the READ and the UPDATE. Can you run that in debug and see a
value for ID right before the UPDATE? Does it write that out? If ID is
equal to anything other than a zero prior to the UPDATE then I would think
this a PTF issue and not an rfe issue.


Rob Berendt
--
IBM Certified System Administrator - IBM i 6.1 Group Dekko Dept 1600 Mail
to: 2505 Dekko Drive
Garrett, IN 46738
Ship to: Dock 108
6928N 400E
Kendallville, IN 46755
http://www.dekko.com


--
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: https://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/midrange-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 thread ...

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.