Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

STRQMQRY Command

292 views
Skip to first unread message

The Cabin

unread,
Jun 3, 1998, 3:00:00 AM6/3/98
to

I know I've seen several posts on how to get variables into an AS400
Query, but I seem to be stuck. I was able to put a variable into the
SELECT RECORDS section, using the ':' but when I try to use the STRQMQRY
command, it says the command "failed". I've tried several variations,
even using F-4, to build my command line, but nothing seems to work.

Like everyone else, I'm trying to make an easy way for several queries
to be run, with ever-changing variables. Any info is appreciated.

ca...@adelphia.net


James Coolbaugh

unread,
Jun 3, 1998, 3:00:00 AM6/3/98
to

You can do variable substitution within STRQMQRY. The variable name within
the SQL statement must be prefixed with an & and must be in all capitals
(this is a common mistake).

Then you use the SETVAR parameter on the STRQMQRY command.

For example,

select * from &FILE


then STRQMQRY qryname SETVAR((FILE 'MYFILE')) or
STRQMQRY qryname SETVAR((FILE &FILE))


Hope this helps.

James Coolbaugh
JDC Computer Services Inc.
IBM Certified Specialist - AS/400 RPG Programmer
j...@ohio.net

tho...@inorbit.com

unread,
Jun 4, 1998, 3:00:00 AM6/4/98
to

James:

One minor correction... the variable need not be in all caps; it simply must
match the case of the variable-name that's passed in through the STRQMQRY
command. Since the name is usually (and best) passed in unquoted, it gets
converted to all caps by default.

Tom Liotta

In article <01bd8eec$e3dd5040$a5c831cf@vzngemwl>,


-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/ Now offering spam-free web-based newsreading

0 new messages