× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Folks, I'm a little "nowhere"...
Well, I received many answers to my post, in the sense to check why ODBC
was being slow, think of changing ODBC driver, change to ADO/OLE/DB,
UNIQUE access paths, Block Insert, etc...
I appreciate all these comments, and am investigating different
alternatives.
But ONE OF THESE ALTERNATIVES was to do it as I said in my original post
"on the fly" with an RPG pgm that simply does "write" instead of via
SQL's INSERT statement...
And so far, apart from all very interesting and thoughtful suggestions,
nobody has even mentioned my original question, to either answer with a
plain "NO, it can't be done", or else, "Yes... do this or that", or
(even better) provide an example.

So, let me present again my original question:

If, in a RPG pgm, I manage to have in a field (let's call it FieldName)
the name of a real field from an externally described file, and in
another field, call it "FieldValue", a value (either alfa or numeric),
is there a way to write something as:
Eval FieldName(??) = FieldValue

Thanks again for you thoughts
Antonio

afvaiv escribio':

>Charles, thanks for your answer.
>I know I could just run the SQL statement. In fact it comes from an ODBC
>connection which is behaving too slow under some circunstances, and we
>got some changes, store it in the IFS as a set of statements, copy them
>to a plain, flat file, in a file, and now I'd like to run them "on the
>fly" directly. If I use dynamic SQL results, I fear, will be as slow (or
>even worse) they were when executed directly under ODBC...
>Any other suggestions?
>Antonio.
>
>CWilt@xxxxxxxxxxxx escribio':
>
>  
>
>>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.
>>>
>>>   
>>>
>>>      
>>>
>>--
>>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.
>>
>>
>> 
>>
>>    
>>
>
>  
>

-- 
Antonio Fernandez-Vicenti
afvaiv@xxxxxxxxxx



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

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.