Whoa. This works? That's awesome. Going to try it out in a few.
-----Original Message-----
From: RPG400-L <rpg400-l-bounces@xxxxxxxxxxxxxxxxxx> On Behalf Of Hiebert, Chris
Sent: Tuesday, July 19, 2022 8:56 AM
To: RPG programming on IBM i <rpg400-l@xxxxxxxxxxxxxxxxxx>
Subject: RE: Update a table from EXTNAME-defined data structure using search argument
You are looking for "Set ROW"
EXEC SQL
UPDATE TABLE1
SET ROW = :TableDS
WHERE key = :TableDS.key;
If you have an identity column then override system value on update, and override user value on insert.
EXEC SQL
UPDATE TABLE1
Overriding System Value
SET ROW = :TableDS
WHERE key = :TableDS.key;
EXEC SQL
INSERT INTO TABLE1
Overriding User Value
Values ( :TableDS );
Chris Hiebert
Senior Programmer/Analyst
Disclaimer: Any views or opinions presented are solely those of the author and do not necessarily represent those of the company.
From: RPG400-L <rpg400-l-bounces@xxxxxxxxxxxxxxxxxx> On Behalf Of Alan Cassidy
Sent: Tuesday, July 19, 2022 7:32 AM
To: rpg400-l@xxxxxxxxxxxxxxxxxx
Subject: Update a table from EXTNAME-defined data structure using search argument
Good morning folks,
I am updating a file. I have an externally defined data structure
defined with EXTNAME().
I can't find a specific reference anywhere, but is there a syntax to use
that data structure to update the row in the table, like so, maybe?
UPDATE TABLE1 SET TABLERECD = :TABLE-DS WHERE KEY1 = VALUE1 AND KEY2 =
VALUE2?
I have just seven fields to list out, and I'm doing that, but I just
wondered if there was a way to do the above (without having to input
with an update lock)?
Reason I'm asking is for the future, if I could set it up that way, it
would make it easier to add changes to other columns, and maybe other thins.
--Alan Cassidy
--
This is the RPG programming on IBM i (RPG400-L) mailing list To post a message email: RPG400-L@xxxxxxxxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit:
https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives at
https://archive.midrange.com/rpg400-l.
Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription related questions.
Help support midrange.com by shopping at amazon.com with our affiliate link:
https://amazon.midrange.com
As an Amazon Associate we earn from qualifying purchases.