Topic
  • 4 replies
  • Latest Post - ‏2014-08-11T14:55:29Z by HowardChen
Greg.Helton
Greg.Helton
1 Post

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
    25 Posts
    ACCEPTED ANSWER

    Re: OPNQRYF but with SQL?

    ‏2014-07-25T03:33:35Z  

    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

  • tomliotta
    tomliotta
    25 Posts

    Re: OPNQRYF but with SQL?

    ‏2014-07-25T03:33:35Z  

    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
    71 Posts

    Re: OPNQRYF but with SQL?

    ‏2014-07-29T20:29:34Z  

    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
    25 Posts

    Re: OPNQRYF but with SQL?

    ‏2014-07-30T13:29:12Z  
    • Damery
    • ‏2014-07-29T20:29:34Z

    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.

    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

    Re: OPNQRYF but with SQL?

    ‏2014-08-11T14:55:29Z  

    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