× 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.



The clock chimed 4:48 PM -0700 6/21/99 when Joel Fritz scribbled:
>This is an appeal to someone who actually knows something about sql.  All I
>know I learned from rtvqmqry.
>
>The following is a qmqry extracted from a query400 object and given some
>parameters.  It runs fine interactively either with message prompting or by
>providing it all the setvar values it needs.  It will not run in batch when
>provided the same setvar values that work interactively.  The error message
>is:  "Message . . . . :   Keyword BY not expected. Valid tokens: FOR WITH
>ORDER UNION OPTIMIZE."
>
>The offending query looks like this:
>
> SELECT
>   ALL       T02.ORDTYP, T02.ORD#, T01.VND, T01.ITM, T01.STY, T01.QTYORD,
>             T01.LINSTS, LINCST*(QTYORD) AS EXTCST, T01.SHPYR, T01.SHPMD
>   FROM      NEWFIL/LIN T01,
>             NEWFIL/ORD T02
>   WHERE     T01.ORD# = T02.ORD#
>     AND    (SRCCD = &S OR SRCCD = &SM)
>     AND     SHPYR BETWEEN &Y AND 99
>     AND     SHPMD BETWEEN &MD AND 1231
>     AND     VND = &V
>     AND     ITM = &I
>     AND     STY = &SL
>   ORDER BY  T01.SHPYR ASC, T01.SHPMD ASC
>
>
>
>I know the variable names are cryptic, I tried to shorten them to see if the
>length of the where clause was a problem.  I've also tried passing one long
>string for the where clause which doesn't work because it's over 55
>characters.  We're running v4r3 and don't have the full sql package.
>
>I'd be grateful for any insight, even something that begins "Of course it
>doesn't work..."
>
>###########################################
>The above is my personal opinion and is not intended to represent good
>programming practice or the product of a sound mind.
>
>Joel Fritz

Joel,

I am not a real sql expert, but I'm sure the variable names are set to
their values before the Where clause is interpreted, so shortening the
names shouldn't make any difference. Have you tried adding more
parentheses? It sounds like the Order By clause is getting mixed into the
Where clause. Have you looked at the joblog? It might show you what the sql
statement looks like with the variables replaced.

If you are really lucky, someone who knows more than I do will give you a
better answer than I can.

good luck,
Malcolm


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

Replies:

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.