Query

85 pts.
Tags:
Database
IBM DB2
Oracle
SQL
I need to create a query on a file that has several detail lines for the same shipper number, I would like to see only one line per shipper number, using SQL I get the result I want by using the following command --- SELECT DISTINCT compny, shpinv, acode, cabbv, dabbv, shipdt, oem FROM futdtalib/vlpasn WHERE acode = 'I' How can I get the same results using Query so that I can schedule a job to run nightly and create a report. Any help would be appreciated. I have been away from the 400 for a while :) thanks

Answer Wiki

Thanks. We'll let you know when a new response is added.

You may find RUNSQLSTM easier than using query. Just cut and paste your statement into a source member, add a semicolon to the end of the statement. then use command RUNSQLSTM to execute it.

Discuss This Question: 1  Reply

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • JohndeCoville
    Excellent response from Keith Hodges. I've been using this since IBM Rochester let me know about RUNSQLSTM: From: KeithHodges send a private message to KeithHodges Date Sent: 06 Dec 2006 10:40 EST (15:40 GMT) Subject: RE: Query You may find RUNSQLSTM easier than using query. Just cut and paste your statement into a source member, add a semicolon to the end of the statement. then use command RUNSQLSTM to execute it. A. Titus, All you need to do is create a source file such as QSQLSRC and create that source member he mentions. - John Example: Work with Members Using PDM POQUITO File . . . . . . QSQLSRC Text OWN_MASLH RPGLE Roll Bus & Pers Names into ALPHANAME 11/01/2006 *************** Beginning of data CREATE VIEW OWN_MASLH ( PARCEL_ID, BOOK, MAP, PARCEL, SPLIT, CHK_DIG, TAX_ID, BUS_NAME, C_O, LNAME, FNAME, MIDDLE, GEN, ALPHANAME, T1DELF, LINE_NBR_M, NAME_TYPE, R_TAX_YEAR ) AS SELECT PARCEL_ID, BOOK, MAP, PARCEL, CHK_DIG, TAX_ID, BUS_NAME, C_O, FNAME, MIDDLE, GEN, T1DELF, LINE_NBR_M, NAME_TYPE, R_TAX_YEAR, CASE WHEN TRIM(LNAME) ' ' THEN LNAME || ' ' || FNAME || ' ' || MIDDLE || ' ' || G ELSE BUS_NAME END AS ALPHANAME FROM OWN_MAS My example creates something like a logical which you can read from end-to-end like a report. I wish I could index it.
    0 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following