|
Wouldn't it be easier just to the run the SQL statement? You could even change the INSERT into an UPDATE if need be. Besides which, I'm pretty sure the answer to you question. You can't update a field given the fieldname stored in a variable (at least in RPG). Look in the archives and you should find some discussions along these lines. Most will recommend you simple use dynamic SQL. HTH, Charles > -----Original Message----- > From: afvaiv [mailto:afvaiv@xxxxxxxxxx] > Sent: Friday, June 11, 2004 8:45 AM > To: RPG400-L > Subject: Howto use fields "by name" > > > Folks, > I don't know if the following can be done or not. > I'm reading a file, whose records contain SQL sentences like > "INSERT INTO xxxxx (fielda, fieldh, fieldx) VALUES ('aaaaa',18,'xyz'); > > I want to be able to > - parse that sentence, > - read the field names in a loop, into a variable that will > contain one > field name at a time > - read the new values in same loop, into a variable that will contain > one value at a time > > now comes the question: > > I would have to do a lot of "case" sentences, or nested > "if's" so that > in the end I could either MOVE or EVAL each field to its new > value. The > question is: since I will have the field name as the value > contained in > a variable called "FieldName", > can I do some kind of Eval of the real field to the > desired value, > addressing the field by the name contained in FieldName? > > I hope I made it clear enough. > > Any examples or hints? > TIA > > -- > Antonio Fernandez-Vicenti > afvaiv@xxxxxxxxxx > > > -- > This is the RPG programming on the AS400 / iSeries (RPG400-L) > mailing list > To post a message email: RPG400-L@xxxxxxxxxxxx > To subscribe, unsubscribe, or change list options, > visit: http://lists.midrange.com/mailman/listinfo/rpg400-l > or email: RPG400-L-request@xxxxxxxxxxxx > Before posting, please take a moment to review the archives > at http://archive.midrange.com/rpg400-l. >
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 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.