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

I have a bit of a question regarding the best way to go about extracting
data from the performance data tables using SQL.

Currently I am (manually) running a command to Display a list of members to
an outfile in QTEMP then querying the table in QTEMP to get a list of the
members e.g.:
CALL QSYS.QCMDEXC('DSPFD FILE(QPFRDATA/QAPMISUM) TYPE(*MBRLIST)
OUTPUT(*OUTFILE) OUTFILE(QTEMP/DSPFD)', 0000000082.00000);
SELECT MLNAME, MLCDAT FROM QTEMP.DSPFD;

I then run a statement to do an OVRDBF and run the subsequent SELECT
statement like so:
CALL QSYS.QCMDEXC('OVRDBF FILE(QAPMISUM) TOFILE(QPFRDATA/QAPMISUM)
MBR("member name") OVRSCOPE(*JOB)', 0000000078.00000);
SELECT * FROM QPFRDATA.QAPMISUM

After that I copy and paste the data into a worksheet.and repeat for each
day of the month I am looking at. The Select statement I actually use is a
bit more complicated (and specifies some columns rather than *) but I did
not want to post the entire statement here to cut down on unnecessary
detail.

I know I could write an RPG program to list the members and then loop
through each of them and run the SQL Statement after doing the OVRDBF, what
I am wondering is, how would I go about this using SQL as the main tool for
the solution ?

Can I do the whole thing as SQL or would I need to write some stored procs
or something else on the i to accomplish extracting a month of data at a
time. Right now I look at the member creation to limit the data to a single
month. The goal would be to create either a consolidated table on the i for
download or a .csv file for copy and paste import into Excel.The main thing
is to prodice whatever the output is in one pass (if possible).

I also know I could write a python script (or similar) on a PC - or the i I
guess - to extract the data but I am looking to see if I can learn how to
structure this as a "purely SQL" solution for the i as a learning exercise.

I want to run this on a number of different machines and it is simpler to
run SQL scripts than try and go through multiple change control processes
if I have to create programs (though I can do that if absolutley required).
Let's not quibble over why I can run SQL statements but programs need
change control...

So can I write some kind of clever script that loops through or somehow
selects the required members or do I need to write an RPG or CL to control
that part of the logic

Any suggestions welcome, I am just looking to learn something if I can.


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

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.