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




Hi, this works for me,

Need to add quotes to your parm, and specify the parm in the actual qm member.


DCL VAR(&LOC) TYPE(*CHAR) LEN(3)
DCL VAR(&LOC1) TYPE(*CHAR) LEN(5)
DCL VAR(&QUOTE) TYPE(*CHAR) LEN(1) VALUE('''')

IF COND(&CURFLG *EQ 'Y') THEN(DO)
CHGVAR VAR(&SLOC) VALUE('S' || &LOC)
CHGVAR VAR(&LOC1) VALUE(&QUOTE || &LOC || &QUOTE)
CLRPFM FILE(INVQOHGL)

STRQMQRY QMQRY(INVQOHGL) SETVAR((LOC1 &LOC1))

in the query . . .

l.opendate > 0 and
id.status <> 'D' and id.majorcl <> 'F' and location = &LOC1
order by sku



Hope this helps.
Sharon


Subject: Dumb question about STRQMQRY passing parms
Date: Fri, 9 Jan 2009 13:11:36 -0500
From: srowe@xxxxxxxxx
To: RPG400-L@xxxxxxxxxxxx

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.


_________________________________________________________________
Windows Live™ Hotmail®: Chat. Store. Share. Do more with mail.
http://windowslive.com/explore?ocid=TXT_TAGLM_WL_t1_hm_justgotbetter_explore_012009

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.