ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Refer a Data Base Field Dynamically

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Refer a Data Base Field Dynamically

    Hi there,

    I wonder if there is a way to refer a DataBase Field Dynamically. I know i can achieve this in SQLRPGLE.
    Let me explain in detail.
    I have this field FLD001 of Length 10, Alphanumeric Type and I have this file that is declared in F-Spec. FLD001 stores the field name of field present in file that i declared in F-Spec. Is there any way I can get the value of Field present in FLD001.

    Example:
    EMP File got EMPID and EMPNAME Fields.
    FLD001 = 'EMPID';

    Is there any way i can get the value of EMPID(FLD001 has EMPID) without using SQLRPGLE. I was thinking to use Pointers but no results. So i need help.

  • #2
    It is not trivial, but it can be done with enough of the Call Level Interface (CLI) APIs. If you've done advanced ODBC work, it shouldn't be too bad.
    Tom

    There are only two hard things in Computer Science: cache invalidation, naming things and off-by-one errors.

    Why is it that all of the instruments seeking intelligent life in the universe are pointed away from Earth?

    Comment


    • #3
      It would make it easier for us to suggest appropriate alternatives if you would tell us WHY you need to do this. As you have noted SQL can do this and frankly it is the perfect tool for the job. Plus of course you are still using SQL if you use ODBC or the CLI APIs or ... SQL is also available on every IBM i system - nothing to install - so why not use it? help us to understand.

      Comment


      • #4
        JonBoy I started looking into SQL CLI when it was less common for the SQL Dev Kit to be available. (And I'm practically certain you also ran into that.) I still have one system without it, and it's doomed to remain that way at V5R3. Probably many similar "doomed" systems around the world.

        Of course, if this is simply a performance concern or something like that, it's hardly worth it, if at all. A couple decades back, it was more useful. Now it's almost just personal curiosity and education.
        Tom

        There are only two hard things in Computer Science: cache invalidation, naming things and off-by-one errors.

        Why is it that all of the instruments seeking intelligent life in the universe are pointed away from Earth?

        Comment


        • #5
          Originally posted by tomliotta View Post
          JonBoy I started looking into SQL CLI when it was less common for the SQL Dev Kit to be available. (And I'm practically certain you also ran into that.) I still have one system without it, and it's doomed to remain that way at V5R3. Probably many similar "doomed" systems around the world.

          Of course, if this is simply a performance concern or something like that, it's hardly worth it, if at all. A couple decades back, it was more useful. Now it's almost just personal curiosity and education.
          Sorry Tom - I should have been clearer. When I said "available on every IBM i system" I meant from the perspective of run time. As you say there are still some systems without the development kit.

          Comment

          Working...
          X