IBM added a new command RUNSQL in V7r1 (in 2012 via ptf) and ptf'd it also into V6R1.
Infocenter has doc on how it works. This is not all the features of iNav or STRSQL..
http://pic.dhe.ibm.com/infocenter/iseries/v7r1m0/index.jsp?topic=%2Fsqlp%2Frbafyrunsql.htm

What IBM did not do is some new way to read files or result sets. But CLP has always had RCVF to read records in a file,
so the above link to the infocenter has this example

In a CL program, you could use the Receive File (RCVF) command to read the results of the table generated for this query:
RUNSQL SQL('CREATE TABLE qtemp.worktable AS
(SELECT * FROM qsys2.systables WHERE table_schema = ''MYSCHEMA'') WITH DATA')
COMMIT(*NONE) NAMING(*SQL)So I did a test RUNSQL SQL('create table qtemp.worktable as (select distinct bid from tran) with data') COMMIT(*NONE) and got a file Display Physical File Member File . . . . . . : WORKTABLE Library . . . . : QTEMPMember . . . . . : WORKTABLE Record . . . . . : 1 Control . . . . . Column . . . . . : 1 Find . . . . . . . *...+. A.A50 A&A44 A&A75 A&B60 A-A50 A-112 AAC25 Read the InfoCenter link above for all the limitations. Jim Franz ----- Original Message ----- From: "Hoteltravelfundotcom" <hoteltravelfun@xxxxxxxxx>
To: "Midrange Systems Technical Discussion" <midrange-l@xxxxxxxxxxxx>
Sent: Sunday, June 01, 2014 7:02 PM
Subject: how to use the Select Distinct




Return to Archive home page | Return to MIDRANGE.COM home page