If you can execute RUNSQL, I'd neither use Query/400 nor QMQRY.
Even though SELECT is not supported, it is possible to create a (temporary)
SQL view representing the result of an SELECT statement. This view can be
registered with the DCLF command and read with the RCVF command.
The only downside is, the sequence of rows returned by the view cannot be
predefined.
If the records must be returned in a specific sequence, creating a temporary
table based on a SELECT statement with an ORDER BY clause and reading this
temporary table may be an option.
Mit freundlichen Grüßen / Best regards
Birgitta Hauser
"Shoot for the moon, even if you miss, you'll land among the stars." (Les
Brown)
"If you think education is expensive, try ignorance." (Derek Bok)
"What is worse than training your staff and losing them? Not training them
and keeping them!"
-----Ursprüngliche Nachricht-----
Von: midrange-l-bounces@xxxxxxxxxxxx
[mailto:midrange-l-bounces@xxxxxxxxxxxx] Im Auftrag von Vernon Hamberg
Gesendet: Tuesday, 02.7 2013 15:45
An: Midrange Systems Technical Discussion
Betreff: Re: how to use sql distinct in CL?
You have a couple options - do you want to create a table with the results?
Or do you need to display them?
If a result table, and you are at 7.1, you can use the new RUNSQL command -
it cannot do SELECTs directly.
With an older release and up, you can create a source member and use
RUNSQLSTM.
I suggest forgetting about Query/400 - unless it's an already-existing one -
and use QM queries. Those can have SQL statements - even SELECT.
You can even take your Query/400 and convert it to a QM query, then add the
distinct to the result there.
CRTSRCPF YOURLIB/QQMQRYSRC RCDLEN(91)
RTVQMQRY QRY400NAME YOURLIB/QQMQRYSRC (something like that - prompt
the command)
Check the result for what you want - there are some odd things when
converting to QMQRYs.
Open the source member you get and see a SELECT statement - add the DISTINCT
as you need.
CRTQMQRY over that source member.
STRQMQRY to run it in CL - ba-da-boom!
HTH
Vern
On 7/2/2013 8:30 AM, Hoteltravelfundotcom wrote:
I have a ad hoc process, where I can make use of the DISTINCT feature
of SQL
THe CL would first run query400 then I need the results as
Distinct.
Can you do that SQL statement in a CL?
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx To subscribe, unsubscribe,
or change list options,
visit:
http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx Before posting, please take a
moment to review the archives at
http://archive.midrange.com/midrange-l.
As an Amazon Associate we earn from qualifying purchases.