× 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.


  • Subject: RE: Indirect addressing databasefields
  • From: "Stone, Brad V (TC)" <bvstone@xxxxxxxxxxxxxx>
  • Date: Tue, 5 Dec 2000 10:12:44 -0600

This has been covered before.  IT can be done, but it's tricky.  I think you
could use APIs and dynamic SQL to get the job done.  I started on something
like this, and actually got it working but found out that performance was
terrible.

My routine is something like this.  I write a subprocedure that accepts
parms:

#RtvValue(FileName:LibraryName:Member:FieldName:Key1:Value1:Key2:Value2:Key3
....)

Inside the #RtvValue subprocedure I build a dynimic SQL statement like
this...
----------
If (Member <> ' ')
 OvrDbf(file) to member(Member)
Endif

Select RRN(a), CHAR(A.FieldName) from LibraryName/FileName Where
Key1 = Value1, Key2 = Value2.... INTO :Value

RETURN Value
-------
This worked fairly well.  I even set up special keywords like *POS = Same to
read the same record by RRN to make it faster to retrieve values from the
same record, *NEXT to read after the last record, etc.  It always returned a
character value, though.

I don't have it into production, because I haven't worked with it for some
time.  But I was making some progress.

Brad

> -----Original Message-----
> From: Sven Mitscherlich [mailto:sms_mitschs@sms-as400.de]
> Sent: Tuesday, December 05, 2000 9:08 AM
> To: RPG400-L@midrange.com
> Subject: Indirect addressing databasefields
> 
> 
> Hello members,
> may I first intruduce me because this is my first post to this list.
> My name is Sven Mitscherlich, free consultant in the 
> IBM-Midrange-World, living in Germany ;-)
> 
> Now my question in the hope to get an answer:
> Is there any method available to indirect address a 
> databasefield, meaning the name of the databasefield is 
> stored in a variable.
> 
> I do not want to code a huge (and badly maintenable) 
> select-group. What I want is a method of flexibly 
> changeable rules to modify data using them.
> 
> Any advice is much appreciated.
> 
> Greetings from Germany
> 
> 
> Sven Mitscherlich
> SMS - System-Management-Software
> 
> +---
> | 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 thread ...


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.