|
Try starting degug (you don't have to specify a program), then run the SQL. Then look in the joblog. Some SQL messages are placed there when in debug. My guess is that there is a mismatch in the substitution parameters. Bob Joel Fritz wrote: > 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 > +--- > | 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 > +--- +--- | 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 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.