Topic
IC4NOTICE: developerWorks Community will be offline May 29-30, 2015 while we upgrade to the latest version of IBM Connections. For more information, read our upgrade FAQ.
4 replies Latest Post - ‏2014-08-11T14:55:29Z by HowardChen
Greg.Helton
Greg.Helton
1 Post
ACCEPTED ANSWER

Pinned topic OPNQRYF but with SQL?

‏2014-07-24T20:56:57Z |

Is there any functionality that provides functionality similar to OPNQRYF + OVRDBF but with SQL instead of OPNQRYF?  It would be nice to override a program's F spec to a result set produced by SQL.  This is probably trivial with open access? 

 

Thanks!

  • tomliotta
    tomliotta
    19 Posts
    ACCEPTED ANSWER

    Re: OPNQRYF but with SQL?

    ‏2014-07-25T03:33:35Z  in response to Greg.Helton

    It can be done using CREATE VIEW and OVRDBF for basic non-keyed access. It might be possible for some form of keyed access, but nothing comes to mind off the top of my head.

    Tom

  • Damery
    Damery
    70 Posts
    ACCEPTED ANSWER

    Re: OPNQRYF but with SQL?

    ‏2014-07-29T20:29:34Z  in response to Greg.Helton

    Without much detail you can create a view of the Data set you want to return using an SQL VIEW and if you need to OVRDBF to a certain member you can use an SQL ALIAS to Correlate to a certain File member so you can access with Sql script.

    • tomliotta
      tomliotta
      19 Posts
      ACCEPTED ANSWER

      Re: OPNQRYF but with SQL?

      ‏2014-07-30T13:29:12Z  in response to Damery

      Access with SQL script doesn't seem particularly useful here. The replacement of OPNQRYF seems to imply that RPG (or other language) programs are already written using native I/O. The question seems to want to replace the control coding that contains OPNQRYF without needing to re-code the inner programs.

      But maybe the OP has more in mind and could clarify. If the inner programming could be reworked, most issues with OPNQRYF could be eliminated.

      Tom

  • HowardChen
    HowardChen
    4 Posts
    ACCEPTED ANSWER

    Re: OPNQRYF but with SQL?

    ‏2014-08-11T14:55:29Z  in response to Greg.Helton

    Dan Cruikshank has an excellent article on SQL and RPG open access here:

    http://www.ibm.com/developerworks/ibmi/library/i-roaforsql/index.html?ca=dat