|
Define a field &CSTNBRPARM as 7 alpha CHGVAR &CSTNBRPARM VALUE('''' *TCAT &CSTNBR *TCAT '''') I think I got the syntax right. You need to have quotes around the field. The query thinks you are passing it a field name. John Hall Home Sales Co. Dennis Munro wrote: > > AS/400 V4R5M0 > > I must be missing something in my attempt to not see the forest for all the > trees so I am looking for some help. > > I have a simple CL program displaying a prompt screen for a customer number > (alpha) which is to be passed in as a variable to the following QM/400 > query: > > STRQMQRY QMQRY(QGPL/SLSHSTQ01) OUTPUT(*PRINT) + > QMFORM(QGPL/SLSHSTF01) DATETIME(*NO) + > PAGNBR(*NO) SETVAR(CUSNO &CSTNBR) > > The screen defines the &CSTNBR field as 5 alpha. > > The following is the SQL portion of the query: > > SELECT > > -- Columns > > A.SLCSNO, A.SLSTNO, A.SLORDR, A.SLSSDT, A.SLLGNO, A.SLINDT, A.SLINNO, > > A.SLITEM, A.SLDESC, A.SLTONS, A.SLPAMT, B.CMNAME > > -- Tables > > FROM "BMCNTVFLS"/"SLHIST" A, > > "BMCNTVFLS"/"CUSMAS" B > > -- Join Conditions > > WHERE A.SLCSNO = B.CMCSNO > > AND A.SLCSNO = &CUSNO > > -- Sort Columns > > ORDER BY A.SLINDT, A.SLINNO > > When I run the CL program, I get the following error: > > (12014 is the customer number entered on the prompt screen.) > > 12014 is not a valid Query Management variable. > > Message . . . . : 12014 is not a valid Query Management variable. > Cause . . . . . : The 12014 variable entered on the SETVAR parameter > contains a value which is not valid. The return code is 1. > > The following return codes are possible: > > 1 - The first character is not alphabetic. > > Error found on STRQMQRY command. > CPF0001 received by SLSHSTCL at 2300. (C D I R) > > All the other QM/400 queries I have coded have all used numeric variables > (really hard to believe) & this is the first where I am comparing to an > alpha data base field. > > I've tried single quotes, double quotes, single & double quotes. The > example in the book does not even use quotes. > > When I run the command manually, I enter the variable as '12014' when > prompted. > > What am I missing? > > Thanks - Dennis. > > Dennis Munro +--- | 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.