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



Shari,

First this question has little to do with RPG, so would be best on the
Midrange-L list.

There have been many threads there on how to pass parms to QMQRY. One
that I was involved can be found at;

http://archive.midrange.com/midrange-l/200712/msg00938.html

All parms are passed as character, the numbers just don't have single
quotes around them. I would eliminate any problems with quotes by
adding a variable to your QMQRY like &Q. Then set the variable like

dcl &Q *char 1 ''''

Then you can pass 3 parms to your QMQRY. &fromdate &todate and &Q.

Your select could look like

select *
from filename
where mydate between (&Q&FROMDATE&Q &QTODATE&Q)

QMQRY puts the quotes around the fields for you.

HTH

Jim




On Fri, Jan 9, 2009 at 11:11 AM, Rowe, Sheri <srowe@xxxxxxxxx> wrote:
Hi List,



I have converted a QUERY/400 query to QM, so that I can pass 2 parms to it. The QM is fine and I can run it on-line successfully, it prompts for the fields I want and I enter them successfully. My problem is I am trying to run it in batch, so that is can be run through our job scheduler, and it fails. I have fiddled with changing the parms to be numeric but it still didn't work. After a day and ½ of testing I am exasperated, as I know the solution must be very simple.





Here is my CL



PGM PARM(&from &to)



DCL VAR(&from ) TYPE(*CHAR) LEN(6)

DCL VAR(&QryFrom) TYPE(*CHAR) LEN(8)

DCL VAR(&to ) TYPE(*CHAR) LEN(6)

DCL VAR(&QryTo) TYPE(*CHAR) LEN(8)



ChgVar Var(&QryFrom) +

Value('''' *cat &from *Cat '''')

ChgVar Var(&QryTo) +

Value('''' *cat &to *Cat '''')



STRQMQRY QMQRY(ZROYIRON) QMFORM(ZROYIRON) +

DATETIME(*NO) PAGNBR(*NO) ALWQRYDFN(*yes) +

SETVAR((FROMDATE &QRYFROM) (TODATE &QRYTO))



EndPgm



Here is my submit statement:

SBMJOB CMD(CALL PGM(RUNZROYIRN) PARM('080101' '081231'))



Here is the error log I get.

Message . . . . : -CALL PGM(RUNZROYIRN) PARM('080101' '081231')

01/09/09 12:36:04.266408 QCADRV QSYS 03AE RUNZROYIRN SROWE

Message . . . . : 2700 - STRQMQRY QMQRY(ZROYIRON) QMFORM(ZROYIRON)

DATETIME(*NO) PAGNBR(*NO) ALWQRYDFN(*YES) SETVAR((FROMDATE '''080101''')

(TODATE '''081231'''))



20 01/09/09 12:36:04.369792 QQXSRV01 QSYS *STMT QQXSRV01 QSYS

From module . . . . . . . . : QQXCPIMESS

From procedure . . . . . . : QQxCPIMessage__SendMessage

Statement . . . . . . . . . : 16

To module . . . . . . . . . : QQXCPISTRI

To procedure . . . . . . . : QQxCPIString__ResolveSingleVar

Statement . . . . . . . . . : 37

Message . . . . : Global variable prompting is not allowed in batch mode.

Cause . . . . . : You tried to use the variable

"fromdate " before it was set. Prompting for variables

cannot be done in batch mode. Recovery . . . : If you are using the

STRQMQRY command you can set variable "fromdate " by

using the SETVAR keyword. If variable "fromdate " is

being used in a Query Management procedure, put a SET GLOBAL query command

in the procedure to give the variable a value. If variable

"fromdate " is being used through the Query Management

callable programming interface your program should be changed to use the SET

GLOBAL query command. After you set the variable, try the request again.





Thanks for any assistance.



Sheri







--
This is the RPG programming on the IBM i / System i (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.



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.