|
> I am attempting to create a command that will execute a query > management query and I am becoming quite frustrated. I am attempting -snip- > 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. -snip- > It's like the system is not recognizing that 668 is a character field > even though I have defined it as such. Chris, You've hit the nail on the head. When you send the 3 characters 668 to SQL, they are interpreted as a number. You have met an interesting command parser situation. What you need to type is PROG(' ' ' 668 ' ' ') The first quote says "Here starts a string literal". The next two quotes say "This is a single quote" The final single quote says "Here ends a string literal". To avoid this hassle, try changing your CLP to add quotes around your input number: CHGVAR &PROG (' ' ' ' *CAT &PROG *CAT ' ' ' '). For what it's worth, folks have been pestered by this sort of stuff ever since OPNQRYF came out on the S/38... hope this helps! Buck Calabro Commsoft, Albany, NY +--- | 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 mailing list archive is Copyright 1997-2025 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.