× 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: Passing parameters to a query
  • From: "Scott Klement" <infosys@xxxxxxxxxxxx>
  • Date: 22 Jun 1999 15:59:28 -0500

If were talking about OPNQRYF here (and I suspect that the original
poster was NOT) then all you have to do is concatenate the parms
into the physical command string...

Not sure why you'd build the query select from an RPG program, then
pass it to a CL program...   I'd just do the OPNQRYF from the RPG,
if its easier to build the selection from RPG...

Tho, it is a bit easier to code in CL, with the free-form syntax
being native, and the ability to prompt the command...

FWIW, you could do it in RPG with something like this:


FMYFILE    IF   E           K DISK    USROPN

c     *entry        plist
C                   PARM                    CHARCUST          5

C                   eval      Cmd = 'OVRDBF FILE(MYFILE) -
C                             SHARE(*YES)'

C                   call      'QCMDEXC'
c                   parm                    Cmd             256
c                   parm      256           Len              15 5

                    eval      Cmd = 'OPNQRYF FILE((MYFILE)) -
                              QRYSLT(''CUSTNO *EQ ' + CHARCUST +
                              ''')'

C                   call      'QCMDEXC'
c                   parm                    Cmd
c                   parm      256           Len

c                   open      MYFILE

C                   read      MYFILE                                10
C                   dow       *in10 = *off

          ...   do something with data ...

C                   read      MYFILE                                10
C                   enddo

C                   CLOSE     MYFILE

C                   eval      Cmd = 'CLOF MYFILE'
c                   call      'QCMDEXC'
c                   parm                    Cmd
c                   parm      256           Len

C                   eval      Cmd = 'DLTOVR MYFILE'
c                   call      'QCMDEXC'
c                   parm                    Cmd
c                   parm      256           Len

Scott Klement
Information Systems Manager
Klement's Sausage Co, Inc.



BILL@Blumenthalprintworks.com wrote:
>
>
> You can build a query select string in your RPG and pass that to a C
>  which
> inserts it in the OPNQRYF statement.  Doesn't make for very nice
>  coding, though.
> Alternatively, you can pass parameters to the CL and use them to
>  define
> construction of the query select string in the CL.  This probably
>  won't be any
> prettier.
>
>
>
>
>
>
>
> Chris Bipes <ChrisB@cross-check.com> on 06/22/99 12:07:46 PM
>
> Please respond to RPG400-L@midrange.com
>
>
>
>   To:          "'RPG400-L@midrange.com'"
>                <RPG400-L@midrange.com>
>
>   cc:          (bcc: Billy Andrews/Blumenthal)
>
>
>
>   Subject      RE: Passing parameters to a query
>   :
>
>
>
>
>
>
>
>
> I never could figure that out.  I use opnqryf to select data and bui
>  in
> qtemp.  Then run query over qtemp to format & print report.  No
>  selection
> are then coded in the query.
>
> Christopher K. Bipes          mailto:ChrisB@Cross-Check.com
> Sr. Programmer/Analyst        mailto:Chris_Bipes@Yahoo.com
> CrossCheck, Inc.              http://www.cross-check.com
> 6119 State Farm Drive         Phone: 707 586-0551 x 1102
> Rohnert Park  CA  94928       Fax: 707 586-1884
>
>
>
> -----Original Message-----
> From: keshava narasimha [mailto:anandthirta@hotmail.com]
> Sent: Tuesday, June 22, 1999 9:31 AM
> To: RPG400-L@midrange.com
> Subject: Passing parameters to a query
>
>
> Hi there !
>
>
> How can you pass parameters to a query?
>
>
> Thanks.
>
> Keshav
>
>
> ______________________________________________________
> Get Your Private, Free Email at http://www.hotmail.com
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* This is the RPG/400 Discussion Mailing List!  To submit a new         *
* message, send your mail to "RPG400-L@midrange.com".  To unsubscribe   *
* from this list send email to MAJORDOMO@midrange.com and specify       *
* 'unsubscribe RPG400-L' in the body of your message.  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.