× 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: STRQMQRY Question
  • From: <Amit.Mukherjee@xxxxxxxx>
  • Date: Thu, 22 Jan 1998 16:45:44 -0500
  • X400-Content-Type: P2-1988 (22)
  • X400-MTS-Identifier: [/ADMD=IBMX400/C=US/;0042700004409194000002]
  • X400-Originator: Amit.Mukherjee@smed.com
  • X400-Recipients: MIDRANGE-L@midrange.com

Hi!

What the QMQRY expects as the value for the substitution variabe &COND1 is a
char string delimited with single quotes.If it receives a value delimited with
quotes it removes those quotes and takes only the value.For ex if the name of
the program is PGM1 what the QMQRY should receive is 'PGM1' (with the quotes).

So what you have to do is to concatenate these quotes at the begining & the end
of the variable you are passing.

In the CL pgm introduce a variable say   VAR(&PROG1)   Type(*CHAR)     Len(7)

Then concatenate single quotes at the both the ends of the varible you receive
from the command.

CHGVAR VAR(&PROG1)    VALUE('''' *TCAT &PROG *TCAT '''')

Note: To concatenate  a single quote( ' ) to a variable you should include two
single quotations and not a double quote  within a pair of single quotations.
            To put it simply use four single quotes for the purpose as shown
above.

 Then in your STRQMQRY command pass  &PROG1 as the variable to the QMQRY.

STRQMQRY   QMQRY(P668) OUTPUT(*PRINT) QMFORM(P668) +
                               SETVAR((COND1 &PROG1))


Thanks

--Amit Mukherjee





owner-midrange-l@midrange.com on 01/22/98 12:09:27 PM
Please respond to MIDRANGE-L@midrange.com @ Internet
To: MIDRANGE-L@midrange.com @ Internet
cc:
Subject: STRQMQRY Question

     Hi,
     I am attempting to create a command that will execute a query
     management query and I am becoming quite frustrated.  I am attempting
     to follow the example in the Query Manager Reference book on the web
     but am obviously missing something because I can't get it to work.
     Any suggestions would be greatly appreciated.

     Here are the details:

     This is my SQL object called P668

     select A.div,A.acct,A.year, A.code, A.month , A.amount, A.descr,
     A.jrnl from actback A
     where A.prg = &COND1
     ORDER BY A.CODE

     I created a report form called P668 as well.  Inside of query manager,
     I am prompted for a value and I type in '668  ' because field A.prg is
     a 5 character field.  Everything works fine so I don't think there's
     anything wrong with the sql.

     Then I created a CL program called PRGCHRGS:

                  PGM        PARM(&PROG)
                  DCL        VAR(&PROG) TYPE(*CHAR) LEN(5)
                  STRQMQRY   QMQRY(P668) OUTPUT(*PRINT) QMFORM(P668) +
                               SETVAR((COND1 &PROG))
                  ENDPGM

     ...and I created a CMD source called PRGCHRGS:


      CMD        PROMPT('LISTING OF CHARGES FOR PROGRAM')
      PARM       KWD(PROG) TYPE(*CHAR) LEN(5) RTNVAL(*NO) +
                   PROMPT('ENTER PROGRAM NUMBER')


     When I type PRGCHRGS and prompt it, I get my prompt ok.  But when I
     type in 668, whether in quotes or not (I've tried it both ways), I get
     the following:

      PRGCHRGS PROG(668)
      Comparison operator = operands not compatible.
      RUN QUERY command failed with SQLCODE -401.
      RUN QUERY command ended due to error.
      STRQMQRY command failed.
      Function check. QWM2701 unmonitored by PRGCHRGS at statement 300,
        instruction X'000F'.
      QWM2701 received by PRGCHRGS at 300. (C D I R)
      QWM2701 received by PRGCHRGS at 300. (C D I R)

     It's like the system is not recognizing that 668 is a character field
     even though I have defined it as such.

     We are running v3r7.  Sorry for such a long post but I wanted to
     provide as much information as possible.

     Any ideas??

     Thanks in advance,
     Chris Gonzalez











+---
| This is the Midrange System Mailing List!
| To submit a new message, send your mail to "MIDRANGE-L@midrange.com".
| To unsubscribe from this list send email to MIDRANGE-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---





*
+---
| This is the Midrange System Mailing List!
| To submit a new message, send your mail to "MIDRANGE-L@midrange.com".
| To unsubscribe from this list send email to MIDRANGE-L-UNSUB@midrange.com.
| 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.