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



I've seen the QMQRY utilities. They sparked my imagination. Giovanni Perotti added the substitution marker idea as part of HTML scripts-- I saw them before QMQRY. So many things need a few substitutions in a standard script!


However, the main purpose of the QMQRY utilities was getting around the lack of purchased SQL tools like embedded SQL in RPG.


I suggest building a simple RPG, COBOL or C utility to run the passed in select statement. It is very simple as long as the SQL is composed to return one field, which can be fields concatenated together. I have a couple--one a universal lookup window, and one that just returns a field at a time to a caller. Beyond letting you get data back to the caller without an output table, you can have substitution markers in your own template SQL string.


If you are going to an output table, you can use a CREATE TABLE AS command to run the select from RUNSQL. No substitution markers, though; you need to create a separate command to handle them.


You can set up for multiple variable columns back in your utility as well, but that is more work. More payback, but more work, and needs a budget. What I've described is super easy, and can be done as part of any project it eases.



Sent from Outlook<http://aka.ms/weboutlook>


________________________________
From: RPG400-L <rpg400-l-bounces@xxxxxxxxxxxx> on behalf of Vernon Hamberg <vhamberg@xxxxxxxxxxxxxxx>
Sent: Wednesday, February 21, 2018 8:37 AM
To: RPG programming on the IBM i (AS/400 and iSeries)
Subject: Re: Converting QM Query to rpg embedded SQL

To expand a little on Lynne's explanation, it is possible to have a
QMQRY string like this - &Q1&Q2&Q3&Q4&Q5 - this would allow an SQL
statement up to 275 characters long, since each substitution variable
can be at most 55 long. This is the basis of almost all the utilities
people have made (Buck Calabro had one I made a variation of, and
others) that can run any SQL statement, including SELECTs (IBM's RUNSQL
does not directly run SELECT statements). The statement is broken up
into 55-character variables and passed in the SETVAR parameter of
STRQMQRY, which combines them into the statement, as Lynne describes.

I have a presentation and lab I present at COMMON about QM - usually the
lab is all we put on the schedule these days.

Regards
Vern




--


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
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.