25 pts.
 QMQRY not a valid Query Management variable.
Hi there, I am trying to pass parameters to QMQRY but get the following error. CALL PGM(JCCSTREP2) PARM(C165) 'C165' is not a valid Query Management variable. Error found on STRQMQRY command. CPF0001 received by JCCSTREP2 at 2800. (C D I R) the CL pgm that call the query is as follows: PGM PARM(&JOBX) DCL VAR(&JOBX) TYPE(*CHAR) LEN(4) DCL VAR(&JOBA) TYPE(*CHAR) LEN(6) CHGVAR VAR(&JOBA) VALUE('''' *CAT &JOBX *CAT + '''') OVRPRTF FILE(QPQXPRTF) TOFILE(QGPL/JCCSTREP2) + PAGESIZE(*N 257) STRQMQRY QMQRY(JCCSTREP2) OUTPUT(*PRINT) + QMFORM(*QMQRY) SETVAR(('JOB') (&JOBA)) ENDPGM Can someone help me with the correct syntax...Im goin bananas.Cheers Norm

Software/Hardware used:
ASKED: February 19, 2009  7:12 AM
UPDATED: February 23, 2009  11:23 PM

Answer Wiki:
Hi Norm, In your Program JOBX is a variable of type CHAR and it is a parameter too for executing it, then you should pass the parameter value enclosed in a single quotes like here : CALL PGM(JCCSTREP2) PARM('C165') Try the above statement. Regards, Siva
Last Wiki Answer Submitted:  February 20, 2009  6:22 am  by  Sivu   105 pts.
All Answer Wiki Contributors:  Sivu   105 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _


 

Hi Siva,
Thanks for your response. Im trying to replicate PARM(‘C165′) in my CL hence the ”” *CAT &JOB *CAT””
Which from my understanding is supposed to emulate the statement you have written?

The idea is that the user doesn’t have input apostrophes when they input the parameter value C165.

Is there a way to do this using CL and QMQRY?

Much appreciated
Cheers Norm

 25 pts.

 

Norm,

Try this!!!

STRQMQRY QMQRY(JCCSTREP2) OUTPUT(*PRINT) +
QMFORM(*QMQRY) SETVAR(JOB &JOBA)

Regards,
Siva

 105 pts.

 

gave it go..
here is the code:
PGM PARM(&JOBX)
DCL VAR(&JOBX) TYPE(*CHAR) LEN(4)
DCL VAR(&JOBA) TYPE(*CHAR) LEN(6)
CHGVAR VAR(&JOBA) VALUE(”” *CAT &JOBX *CAT +
””)
OVRPRTF FILE(QPQXPRTF) TOFILE(QGPL/JCCSTREP2) +
PAGESIZE(*N 257)
STRQMQRY QMQRY(JCCSTREP2) OUTPUT(*PRINT) +
QMFORM(*QMQRY) SETVAR(JOB &JOBA)
ENDPGM

here is the Joblog:
CALL PGM(JCCSTREP2) PARM(C165)
2600 – OVRPRTF FILE(QPQXPRTF) TOFILE(QGPL/JCCSTREP2) PAGESIZE(*N 257)
2800 – STRQMQRY QMQRY(JCCSTREP2) OUTPUT(*PRINT) QMFORM(*QMQRY)
SETVAR((JOB) (”’C165”’))
‘C165′ is not a valid Query Management variable.
Error found on STRQMQRY command.
CPF0001 received by JCCSTREP2 at 2800. (C D I R)

Still no luck…
Cheers Norm

 25 pts.