|
Am 03.02.2026 um 16:13 schrieb Daniel Gross <daniel@xxxxxxxx>:
If the JSON is incomplete / not parsable, the simplest and at the same time most complicated way to solve that might be REGEXP_SUBSTR und building a regular expression to find exactly what you need.
-> https://www.ibm.com/docs/en/i/7.6.0?topic=functions-regexp-substr
Take some of the JSON strings paste them at
-> https://regex101.com/
Then build a regular expression which hits your status strings as you want them.
The regex
"status":"(.+)"
should find the "status" part and wraps the contents of its value into a capture group. And
regexp_substr(
your_json, '"status":"(.+)"', 1, 1, '', 1
)
should do the extraction of the first occurrence in that JSON string.
If you need more help, send a little bit more of your JSON and what you want exactly to find or extract, and I can try to figure out something.
HTH
Daniel
Am 03.02.2026 um 15:30 schrieb Vern Hamberg via MIDRANGE-L <midrange-l@xxxxxxxxxxxxxxxxxx>:--
Hi Jim
I sometimes use the POSSTR function to get where a string is, along with adding to the returned value to get the end or start of the next thing.
Now if values and all are broken apart and on different rows, maybe you could put them back together with LISTAGG. That function does need something on each row to identify what should go together.
*Regards*
*Vern Hamberg*
IBM Champion 2025 <cid:part1.U4VznBDg.CfM1fKGm@centurylink.net> CAAC (COMMON Americas Advisory Council) IBM Influencer 2023
--On 2/3/2026 8:11 AM, Jim Franz wrote:I'm trying to select the value from a log file which holds part of large
json rows, but the json incomplete and not readable so the "status" never
in same position. I need the value of status.or even the whole string
"status":"Paid"
(scan and substring may be wrong description)
sample data
"status":"Paid","allow
],"status":"Declined",
I can picture this in RPGLE but trying to improve my sql...
Found solutions online but not DB2.
Jim Franz
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.
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-2026 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.