|
Vern,
That was an example with a fixed field.
Here's my final result, working.
I have to run 3 or 4 others with a different search and replace string.
UPDATE qusrijs/QAIJS1CM SET CMCMD = replace (CMCMD , 'UPIC08XXCP',
'&IC08XXCP') WHERE CMJOB = 'ICOM827HYP'
205 rows updated in QAIJS1CM in QUSRIJS.
Thanks for the tip, hard to find an example illustrating this.
Paul
-----Original Message-----
From: MIDRANGE-L [mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of Vernon Hamberg
Sent: Thursday, September 04, 2014 6:28 PM
To: Midrange Systems Technical Discussion
Subject: Re: SQL example command and syntax for search/replace of a string within a field
In SQL it's the replace function -
update yourfile set yourfield = REPLACE ( yourfield , search-string , replace-string )
But your example doesn't look as if it's looking to replace a substring of the field, it's replacing the whole thing.
What have I missed?
HTH
Vern
On 9/4/2014 2:52 PM, Steinmetz, Paul wrote:
I'm looking for an SQL example command and syntax for search/replace of a string within a field.--
The below is in one field, QUSRIJS/QAIJS1CM field is CMCMD.
MOVALLOBJ OBJ(Z8XXK12P/*ALL) TOLIB(UPIC08XXCP) OBJTYPE(*ALL)
OBJOPT(*NEWRPL)
update QUSRIJS/QAIJS1CM set CMCMD = '&IC08XXCHGP' where CMJOB = 'ICO
M827HYP' and CMCMD = 'UPIC08XXCP'
Within AJS, I need to replace hardcoded library names, going to make them variables.
Thank You
_____
Paul Steinmetz
IBM i Systems Administrator
Pencor Services, Inc.
462 Delaware Ave
Palmerton Pa 18071
610-826-9117 work
610-826-9188 fax
610-349-0913 cell
610-377-6012 home
psteinmetz@xxxxxxxxxx
http://www.pencor.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: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at http://archive.midrange.com/midrange-l.
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.