ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

accessing OAR info from QRNOPENACC

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

  • accessing OAR info from QRNOPENACC

    so i'm working on a names values handler and having a little trouble understanding how to access the DS info in QRNOPENACC

    Jon Paris wrote a nice article here https://www.itjungle.com/2010/10/13/fhg101310-story01/

    but I'm still scratching my head.

    Example, i simply want to read the number of fields available in the file and then process each field.
    I'll admit, i'm a little confused when it comes to pointers and i think that is where the issue.

    So for example, i want to build a column list such as...

    For i = 1 to Flds.num; //Process all namesValues fields
    //Set the basing pointer to current field
    Fld_p = %addr(Flds.field(i));
    //Add to the column list if used
    columnList += %TrimR(fld.externalName);
    valuesList += '?'; // Add parameter marker
    //If more than 1 value then add a comma to the lists
    If i < Flds.num;
    columnList += ', ';
    valuesList += ', ';
    EndIf;
    EndFor;

    Where Flds.xxx =

    D QrnNamesValues_T...
    D DS QUALIFIED TEMPLATE ALIGN
    D num 10I 0
    D field LIKEDS(QrnNameValue_T)
    D DIM(32767)

    I just don't know how to reference this DS info from my rpg handler pgm.

    Can someone help?

  • #2
    It is really easy - you just need to read this article (or any of several others I have written) instead. http://ibmsystemsmag.com/ibmi/develo...access/?page=3 start at page 3 as in the link. Even better is to read the updated version of this that uses my template program (which you should get if you haven't already) http://ibmsystemsmag.com/ibmi/develo...ess-templates/

    You don't need to understand pointers AT ALL if you use the templates - it is all been done for you. Including the basic logic required to allocate storage for retaining state information.

    Comment


    • #3
      Thank you.

      um JonBoy - since a handler pgm can be developed generically enough to translate RLA to SQL... isn't there a sample source out there already developed somewhere? I have read several pieces and have coded 3/4 of one of these, but keep asking myself, surely someone has already done this and it is clone-able somewhere... no?

      if the whole coded pgm was included with the below link, it would be a very valuable learning piece.

      Last edited by jayvaughn; October 9, 2017, 01:52 PM.

      Comment


      • #4
        Dan's code is owned by IBM Lab Services and only distributed as part of a database modernization class. The extracts shown are all he was allowed to publish. You'll also find he wrote other examples for IBM's Developerworks web site (I think) and those are a bit more complete.

        But as to complete examples - I gave you the links for more those. The CSV writer is a full fledged generic program that can be used to create any CSV file that CPYTOIMPF can do. My "Web printer" program is out there and that is complete (at least as far as the design point goes).

        Clonable? Yes - that's exactly what the template program I referenced is about. And it is complete except for the logic for what you want/need it to actually do - it is linked from the articles and is available in both fixed and free versions. Not sure how much more I can do for you other than write the rest of the code?

        Comment


        • #5
          Originally posted by JonBoy View Post
          ... Not sure how much more I can do for you other than write the rest of the code?
          yes please - thank you.
          Last edited by jayvaughn; October 9, 2017, 02:23 PM.

          Comment


          • #6
            OK - but it will take at least 6 months! Kinda busy. But as I said if you are doing a generic csv type thing - then the code is already done for you.

            Comment


            • #7
              i'm not doing a generic csv - i'm replicating RLA to SQL - thx - i'll hack through it.

              Comment


              • #8
                Sorry - I scan read and saw the comma reference in the code - I must not make assumptions, I must not make assumptions, I must ...

                Can't help you with that I'm afraid - try contacting Vern Hamburg - the OA handler he wrote converted RLA to ODBC/JDBC/etc. so he might be able to help you. He hangs out on the Midrange forums or I can supply an email if you mail me directly.

                Comment

                Working...
                X