|
Here's a generic update query that requires extreme caution in use that anyone can use as a qmqry. UPDATE &FILE SET &SET WHERE &WHERE Create a qqmqrysrc source file and copy this into a member with any name you like. Use crtqmqry to create the qmqry. If you run it interactively, not too bad on small files, it will prompt you for the file name (&file), the field(s) to be changed and the values to be assigned (&set), and the conditions where the update should take place (&where). You tell it the filename; fld1 = 'X', fld2 = 666 ...; and some logical condition like fld2 < 666. The thing to remember is that you have to be _very_ sure you've entered the correct values for the parms or back up the file first (or maybe back up the file first regardless of how sure you are.) Also, using this query in batch especially when called from a CL program can be a bit tricky. I use it all the time for one shot things. > -----Original Message----- > From: Joe Teff [mailto:jteff19@idt.net] > Sent: Friday, September 24, 1999 12:39 PM > To: RPG400-L@midrange.com > Subject: Re: RPG IV program - comments requested > > > >This brings up a good point, though, as a lot of times I > will have to mass > change > >records, and since we don't have SQL I have to write a > program to do it. > > Use the freeware tool RUNSQL. It uses a QMQRY query and passes the SQL > statement to it. All AS/400s can run this utility. I beleive > News/400 has > this > available. It has been quite a while since I wrote a program > to do a simple > update > like you are talking about. > > Joe Teff > > > +--- > | This is the RPG/400 Mailing List! > | To submit a new message, send your mail to RPG400-L@midrange.com. > | To subscribe to this list send email to RPG400-L-SUB@midrange.com. > | To unsubscribe from this list send email to > RPG400-L-UNSUB@midrange.com. > | Questions should be directed to the list owner/operator: > david@midrange.com > +--- > +--- | This is the RPG/400 Mailing List! | To submit a new message, send your mail to RPG400-L@midrange.com. | To subscribe to this list send email to RPG400-L-SUB@midrange.com. | To unsubscribe from this list send email to RPG400-L-UNSUB@midrange.com. | Questions should be directed to the list owner/operator: david@midrange.com +---
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.