|
I'm not frustrated - yes json_update works - and I'd get it working for one
use case, but then stumble on another use case (ie. update a single
element, append an array to another json, delete an entire array entity
from the json, etc)
I am appreciative of yours and Birgitta's replies - they have helped
seems you may just keep seeing the same post pop up and not reading the
question (and addressed that, assuming it was the same original question...
instead of the actual question I was asking at the time)
BUT I completely fulfilled all my tasks today with json_upd ate and all
questions are now answered.
thanks
Jay
On Wed, Jul 30, 2025 at 11:28 AM Daniel Gross <daniel@xxxxxxxx> wrote:
Hi Jay,and
I'm not aggravated at all, because my JSON_UPDATE code is working fine.
But I can understand your frustration - some 16+ mails back and forth,
still no solution out of nowhere. If you recall correctly, Birgitta andme
helped all along the way, but at some point, it's hard to help someonewho
doesn't want to help himself.you
Why is the JSON doc and the exact source so important?
Simply because JSON_UPDATE doesn't use "lax" JSON path mapping - it only
uses implicit "strict" path mapping - and therefore a small inaccuracy
between the JSON document and the JSON path in the JSON_UPDATE function
will result in an error.
But possibly, you already know all this.
So good luck - if you want me to help, just send a more specific request,
and I will try my very best.
Kind regards,
Daniel
Am 30.07.2025 um 13:54 schrieb Jay Vaughn <jeffersonvaughn@xxxxxxxxx>:see
Daniel,
my code looks 99% better than most.
If you are "tired" take a break buddy - surely someone else has some
json experience in here.
I provided all the code you need.
you can put it in ACS "as-is" and in an sql stored procedure and you'll
how it does not work in the sql stored proc.
but for you, I'd suggest you just ignore these if they are stressing
themout.
I never understood how people have to reply to emails that aggravate
-as opposed ot just ignoring them.
and if you say you are just trying to help, these type replies do not.
youNow I'm too busy for negativity so you won't get anymore of this backfrom
me. sorryand
Jay
On Tue, Jul 29, 2025 at 3:55 PM Daniel Gross <daniel@xxxxxxxx> wrote:
Hi Jay,
I think we did the drill some weeks ago - again and again.
Please post the complete code - probably reduced to and with shortened
anonymous data. Without that, it's a complete guessing game for us.
After about some 20 mails back and forth, reading that last mail of
lookshortenreally makes me think "Does he really expect us to guess again?"
So if you want real help - and not random wild guesses - please reduce
your procedure to the shortest form, that replicates the problem -
informationand anonymize your JSON data - and post it all here with some
basedabout the IBM i version and release that you are using.
I'm really willing to help - but I don't like "random wild guessing
on incomplete information".
You don't have to be ashamed because you think your code might not
usedperfect - we are all here to learn and help each other - no judgement.
And to answer your initial question - yes, JSON_UPDATE does work if
jeffersonvaughn@xxxxxxxxxcorrectly.
Kind regards,
Daniel
Am 29.07.2025 um 21:33 schrieb Jay Vaughn <
and:wrote:
yeah, it is not that - compiled with commit(*none)
thanks for the consideration.
thanks
Jay
On Tue, Jul 29, 2025 at 2:03 PM Peter Dow <petercdow@xxxxxxxxx>
Commitment control? If the procedure is under commitment control,
real,'newValue1'does not do a COMMIT, then any changes it made would be discarded.
--
*Peter Dow* /
909 793-9050
petercdow@xxxxxxxxx
/
On 7/29/2025 5:33 AM, Jay Vaughn wrote:appear
one more lingering strange issue...
the following code works fine in ACS (run sql scripts) but does not
to update the destAddr1 field when this same exact sql statement isinside
an sql procedure - any ideas why not?,'$.destAddr1'
create or *replace* variable jvaughn.ordersArr *clob*(*250*m);
set jvaughn.ordersArr = *json_update*(
jvaughn.ordersArr
,'SET'
runtime.
);
and obviously jvaughn.ordersArr has the same value for each at
jeffersonvaughn@xxxxxxxxx>
tia
Jay V
On Tue, Jul 22, 2025 at 10:28 AM Jay Vaughn<
jeffersonvaughn@xxxxxxxxx>wrote:
got it guys! I needed this...
'$.dtNr'
that is all!
jay
On Tue, Jul 22, 2025 at 8:51 AM Jay Vaughn<
orders),wrote:
ok, I backed up out of the sp and went back to ACS...
what is actually happening in ACS is this...
values
*json_update*(
jvaughn.json2
,'SET'
,'$.orders'
,*trim*(jvaughn.ordersArr)
);
in this statement I want to append the json orders array
(jvaughn.ordersArr) into an existing json (jvaughn.json2)
At the time of this statement jvaughn.json2 looks like this...
{
orders[
{order1}
,{order2}
,{etc}
]
}
but after the above json_update runs (hoping to append to the
Hauser@xxxxxxxxxxxxxxxit
insteadreplaces them all with my single jvaughn.ordersArr..
is there a different reserved word I should be using in this case
of SET?
thanks
Jay
On Tue, Jul 22, 2025 at 2:18 AM Birgitta Hauser<
wrote:
What's the job CCSID where your JSON statement is running?
Perhaps 65535 (=without CCSID)? If so, try to change it to a
Bok)stars."CCSID
(for example 37).
Mit freundlichen Grüßen / Best regards
Birgitta Hauser
Modernization – Education – Consulting on IBM i
Database and Software Architect
IBM Champion since 2020
"Shoot for the moon, even if you miss, you'll land among the
(Les Brown)
"If you think education is expensive, try ignorance." (Derek
Behalfenoughtraining"What is worse than training your staff and losing them? Not
them and keeping them!"
"Train people well enough so they can leave, treat them well
so
(Albertthey don't want to. " (Richard Branson)
"Learning is experience … everything else is only information!"
Einstein)
-----Original Message-----
From: MIDRANGE-L<midrange-l-bounces@xxxxxxxxxxxxxxxxxx> On
')newOf
midrange-l@xxxxxxxxxxxxxxxxxxJay Vaughn
Sent: Monday, 21 July 2025 23:13
To: Midrange Systems Technical Discussion <
Subject: Re: json_update - does it work?
so got the json_update to work in ACS...
Wondering why this works in ACS...
(after it runs, it displays the new jvaughn.ordersArr, with the
value
assigned)
set jvaughn.ordersArr = 'some json';
values
*json_update*(
jvaughn.ordersArr
,'SET'
,'$.destAddr1'
,'newValue1'
);
But if you put the same in an SQL proc and debug it...
(g_ordersArr is populated in debug when you hit the json_update
statement - then after it runs, sqlcode = 0 but g_ordersArr = '
declared
declare g_ordersArr clob(500m);
values
*json_update*(
g_ordersArr
,'SET'
,'$.destAddr1'
,'newValue1'
)
into g_ordersArr;
I even tried doing an "into g_ordersArr2" - a separately
bewrote:memory
storage.
Also switched this up to a set g_ordersArr = json_update...
but same result.
any ideas?
thanks
Jay
On Thu, Jul 17, 2025 at 3:20 PM Daniel Gross<daniel@xxxxxxxx>
Are you sure about TR8?
IIRC the JSON_UPDATE function came with 7.4 TR7 - but I could
7.4https://www.itjungle.com/2022/11/02/trs-deliver-database-and-sql-updatwrong.
->
es-for-every-ibm-i-user/
It might be the best idea, to bring the machine to the latest
2023TR
jeffersonvaughn@xxxxxxxxxat least.
Regards,
Daniel
Am 17.07.2025 um 20:27 schrieb Jay Vaughn <
:
7.4 TR8
I presume this box needs a TR?
Jay
On Thu, Jul 17, 2025 at 2:10 PM Daniel Gross<daniel@xxxxxxxx
wrote:
The JSON_UPDATE function came for release 7.4 in December
-(yet)...
it'sand
a system function - it has no schema to prefix.:
Which release and TR have your boxes?
Your welcome
Daniel
Am 17.07.2025 um 19:52 schrieb Jay Vaughn
<jeffersonvaughn@xxxxxxxxx
thanks Daniel - but it is not a matter of the syntax
daniel@xxxxxxxxcannot
if I do not qualify a lib when using json_update it simply
differentfindthe
scalar function and I get an error.
If I go look for json_update, I find it in systools (two
boxes
-
same way).
apparently the systools version is not working for me.
so what lib is your json_update found in?
thanks
Jay
On Thu, Jul 17, 2025 at 1:35 PM Daniel Gross<
pathhere
wrote:
Hi Jay,
I don't know, which JSON_UPDATE you have found - but this
docforworks
me:
values
json_update(
'{"destAddr1":"foo"}', --> this is the JSON
new'SET', --> set a
value
'$.destAddr1', --> the JSON
newnewto
the
object
'bar' --> the
path.alreadyvalue
);
With 'SET' the value is replaced with the new value if it
exists -
if it doesn't exist, it will be created at the specified
Another option is 'REMOVE' - of course you don't need the
permittedwithvalue
'REMOVE'.
The path is always treated "strict" - "lax" is not
7.4with
https://www.ibm.com/docs/de/i/7.6.0?topic=functions-json-updatJSON_UPDATE.
The result is CLOG(2G) by default.
->
-> e
Which release do your machines have? AFAIK since release
seethe
systoolsjeffersonvaughn@xxxxxxxxxJSON_UPDATE function is a system function - not SYSTOOLS.
HTH and regards,
Daniel
Am 17.07.2025 um 19:07 schrieb Jay Vaughn <
:
there is a version of json_update on both my boxes in
- and examples I look at online show it in systools too.
BUT I totally believe you Birgitta and I'll go look and
26"standardelsewhere
I
can find it.Hauser@xxxxxxxxxxxxxxx>
Jay
On Thu, Jul 17, 2025 at 12:46 PM Birgitta Hauser <
wrote:
JSON_UPDATE is not in the SYSTOOLS schema. It is a SQL
VarChar(16000)https://www.ibm.com/docs/en/i/7.6.0?topic=functions-json-updatefunction:
The following example works for me:
Create Or Replace Table qtemp.JSONCity (JSONText
CCSID 1208 Default '');
Insert into JSONCity
Values('{
"EmployeePerCity": {
"Town": [{
"PostCode": "77880",
"TownName": "Sasbach",
"Attendee": [{
"Name": "Lehmann Maria",
"Street": "Schwarzwaldstr.
"Wald-und-Wiesen-WegGmbH",}]
},
{
"PostCode": "63128",
"TownName": "Dietzenbach",
"Attendee": [{
"Name": "Bauer Herrmann",
"Company": "Große Kartoffeln
"Street":
OnandAnton')17"
GmbH",},
{
"Name": "Fischer Fritz",
"Company": "Fisch und Angel
"Street": "Am Bach 7"
},
{
"Name": "Hauser Birgitta"
}]
},
{
"PostCode": "86916",
"TownName": "Kaufering",
"Attendee": [{
"Name": "Straub Elli",
"Company": "Meier und Sohn",
"PostBox": "12345"
},
{
"Name": "Huber Anna",
"Street": "Nordring 4b",
"PostBox": "11223"
},
{
"Name": "Schmidt Ludwig"
},
{
"Name": "Janssen Jan"
}]
}]
}
}') with nc;
Update JSONCity
set JSONTEXT = JSON_Update(JSONTEXT, 'SET',
'$.EmployeePerCity.Town[1].Attendee[0].Name', 'Gerber,
Limit 1 With NC;
Mit freundlichen Grüßen / Best regards
Birgitta Hauser
Modernization – Education – Consulting on IBM i Database
theSoftware Architect IBM Champion since 2020
"Shoot for the moon, even if you miss, you'll land among
(Derekstars."
(Les
Brown)
"If you think education is expensive, try ignorance."
them?Bok) "What is worse than training your staff and losing
welltrainingNot
them
and keeping them!"
"Train people well enough so they can leave, treat them
experiencesoenough
they don't want to. " (Richard Branson) "Learning is
(Albert… everything else is only information!"
Einstein)
-----Original Message-----
From: MIDRANGE-L<midrange-l-bounces@xxxxxxxxxxxxxxxxxx>
parms...OfBehalf
Jay
midrange-l@xxxxxxxxxxxxxxxxxx>Vaughn
Sent: Thursday, 17 July 2025 18:19
To: Midrange Systems Technical Discussion <
Subject: Re: json_update - does it work?
what is weird is that on both boxes...
if you look at the functions under schema systools (or on
qsys2.sysroutines), you see 2 versions of json_update...
one that requires 5 parms and one that requires 2
bothhas
So I guess my question has to be directed to anyone that
jeffersonvaughn@xxxxxxxxx>successfully
used json_update and how?
thanks
Jay
On Thu, Jul 17, 2025 at 12:05 PM Jay Vaughn <
wrote:
any reason why this simple scenario does not work?
tried this simple scenario on 2 different IBM i's and
.systools.*json_update*(*clob*(*1*g);theerror
same.
create or *replace* variable jvaughn.jsonObj
set jvaughn.jsonObj = '{"destAddr1":"foo"}'; set
jvaughn.jsonObj = systools.bson2json(
systools.json2bson(jvaughn.jsonObj)
,'{ $set: {"destAddr1":"bar"}}'
)
);
I get this error (on both boxes)
Message ID . . . . . . : CPF503E Severity . . .
..
.
. :
30
Message type . . . . . : Notify
Date sent . . . . . . : 07/17/25 Time sent . .
.member
.
. :
12:01:25
Message . . . . : User-defined function error on
whileQSQPTABL.
user-definedCause . . . . . : An error occurred while invoking
function
JSON_UPDATE in library SYSTOOLS. The error occurred
intheinvoking
associated external program or service program QSQJSON
specificlibraryQSYS,
program entry point or external name jsonUpdate2,
archivesfollow:libraryname JSON_00001.
The error occurred on member QSQPTABL file QSQPTABL in
QSYS2.
The
error code is 1. The error codes and their meanings
https://lists.midrange.com/mailman/listinfo/midrange-lerror38553.
1 -- The external program or service program returned
SQLSTATE
The
text message returned from the program is: JSON parsing
(MIDRANGE-L)code:
return.9
for: .
.set: ."destAddr1":"bar".. .
2 -- The external program failed before it completed.
3 -- The database timed out waiting for the program to
The
timeout--
More...
thanks
Jay
This is the Midrange Systems Technical Discussion
mailing
list
To post a message email:MIDRANGE-L@xxxxxxxxxxxxxxxxxx To
subscribe, unsubscribe, or change list options,
visit:
or email:MIDRANGE-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the
archiveshttps://lists.midrange.com/mailman/listinfo/midrange-lat
(MIDRANGE-L)relatedhttps://archive.midrange.com/midrange-l.
Please contactsupport@xxxxxxxxxxxxxxxxxxxx for any
subscription
questions.
--
This is the Midrange Systems Technical Discussion
mailing
list
To post a message email:MIDRANGE-L@xxxxxxxxxxxxxxxxxx To
subscribe, unsubscribe, or change list options,
visit:
or email:MIDRANGE-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the
archives(MIDRANGE-L)at
relatedhttps://archive.midrange.com/midrange-l.
Please contactsupport@xxxxxxxxxxxxxxxxxxxx for any
subscription
questions.--
This is the Midrange Systems Technical Discussion
https://lists.midrange.com/mailman/listinfo/midrange-lmailing
list
To post a message email:MIDRANGE-L@xxxxxxxxxxxxxxxxxx To
subscribe, unsubscribe, or change list options,
visit:
or email:MIDRANGE-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the
athttps://lists.midrange.com/mailman/listinfo/midrange-l
(MIDRANGE-L)subscriptionhttps://archive.midrange.com/midrange-l.
Please contactsupport@xxxxxxxxxxxxxxxxxxxx for any
related questions.
--
This is the Midrange Systems Technical Discussion
listmailing
To post a message email:MIDRANGE-L@xxxxxxxxxxxxxxxxxx To
subscribe, unsubscribe, or change list options,
visit:
(MIDRANGE-L)ator email:MIDRANGE-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
subscriptionhttps://archive.midrange.com/midrange-l.
Please contactsupport@xxxxxxxxxxxxxxxxxxxx for any
related
questions.--
This is the Midrange Systems Technical Discussion
https://lists.midrange.com/mailman/listinfo/midrange-lmailinglist
To post a message email:MIDRANGE-L@xxxxxxxxxxxxxxxxxx To
subscribe, unsubscribe, or change list options,
visit:
ator email:MIDRANGE-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
(MIDRANGE-L)subscriptionhttps://archive.midrange.com/midrange-l.
Please contactsupport@xxxxxxxxxxxxxxxxxxxx for any
related questions.
--
This is the Midrange Systems Technical Discussion
atlistmailing
To post a message email:MIDRANGE-L@xxxxxxxxxxxxxxxxxx To
subscribe, unsubscribe, or change list options,
visit:https://lists.midrange.com/mailman/listinfo/midrange-l
or email:MIDRANGE-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
subscriptionsubscriptionhttps://archive.midrange.com/midrange-l.
Please contactsupport@xxxxxxxxxxxxxxxxxxxx for any
relatedsubscribe,
listquestions.--
This is the Midrange Systems Technical Discussion (MIDRANGE-L)
mailing
To post a message email:MIDRANGE-L@xxxxxxxxxxxxxxxxxx To
unsubscribe, or change list options,
visit:https://lists.midrange.com/mailman/listinfo/midrange-l
or email:MIDRANGE-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives at
https://archive.midrange.com/midrange-l.
Please contactsupport@xxxxxxxxxxxxxxxxxxxx for any
subscriptionmailingrelated questions.
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L)
list To post a message email:MIDRANGE-L@xxxxxxxxxxxxxxxxxx To
subscribe, unsubscribe, or change list options,
visit:https://lists.midrange.com/mailman/listinfo/midrange-l
or email:MIDRANGE-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives at
https://archive.midrange.com/midrange-l.
Please contactsupport@xxxxxxxxxxxxxxxxxxxx for any
mailingmailingrelated questions.--
This is the Midrange Systems Technical Discussion (MIDRANGE-L)
mailinglist To post a message email:MIDRANGE-L@xxxxxxxxxxxxxxxxxx To
subscribe, unsubscribe, or change list options,
visit:https://lists.midrange.com/mailman/listinfo/midrange-l
or email:MIDRANGE-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives at
https://archive.midrange.com/midrange-l.
Please contactsupport@xxxxxxxxxxxxxxxxxxxx for any subscription
related questions.
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L)
--list
To post a message email:MIDRANGE-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit:https://lists.midrange.com/mailman/listinfo/midrange-l
or email:MIDRANGE-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
athttps://archive.midrange.com/midrange-l.
Please contactsupport@xxxxxxxxxxxxxxxxxxxx for any subscription
related questions.
This is the Midrange Systems Technical Discussion (MIDRANGE-L)
mailinglist
relatedTo post a message email: MIDRANGE-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/midrange-l.
Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription
questions.--
This is the Midrange Systems Technical Discussion (MIDRANGE-L)
listlistlist
To post a message email: MIDRANGE-L@xxxxxxxxxxxxxxxxxxrelated questions.
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/midrange-l.
Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing
relatedTo post a message email: MIDRANGE-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/midrange-l.
Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription
listquestions.--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing
To post a message email: MIDRANGE-L@xxxxxxxxxxxxxxxxxxrelated questions.
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/midrange-l.
Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing
To post a message email: MIDRANGE-L@xxxxxxxxxxxxxxxxxx--
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/midrange-l.
Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription related
questions.
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/midrange-l.
Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription related
questions.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 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.