QMQRY!

105 pts.
Tags:
AS/400
AS/400 Query
QMQRY
How can we run multiple select/update query via a single QMQRY?

Software/Hardware used:
AS400
ASKED: June 14, 2013  11:11 AM
UPDATED: June 14, 2013  12:07 PM

Answer Wiki

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

Discuss This Question: 3  Replies

 
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
  • TomLiotta
    Please show actual examples of a sequence that you want to run. It doesn't yet make sense to run multiples in a single QMQRY. If we see a sample that shows what you need, we might have suggestions. . Also, please explain why you want to do it with a QMQRY rather than with an alternative, . Tom
    125,585 pointsBadges:
    report
  • sgautam11
    Actually i wants to update two files of database with two individual complex queries so wants to run both in a single QMQRY !!! Query 1: “MERGE INTO XSDXDTA.ZUEVDF00 T1 USING (SELECT DNDURA, MAMANU, MAMASE, DNRSCD, DNNWCD FROM XSDXDTA.ZUMADF00 INNER JOIN TSBSG.AUTDNDF00 ON MAMAPC = DNMAPC AND MASSCD = DNSTCD AND MAMAI1 = DNQTCD WHERE MAICDT <= (((Select Current date from SYSIBM.SYSDUMMY1) - DNDURA days) - DATE('0001-01-01') + 10101) – 19000000 AND MAMALU = 'TSBSG' ) AS T2 ON T1.EVPEVC = 'PRS' AND T1.EVMANU = T2.MAMANU AND T1.EVMASE = T2.MAMASE AND T1.EVUSER = 'TSBSG' WHEN MATCHED THEN UPDATE SET T1.EVPEN1 = T2.DNNWCD, T1.EVPEN2 = T2.DNRSCD” Query 2: "MERGE INTO XSDXDTA.ZUMADF00 T1 USING ( SELECT DNDURA, DNMAPC, DNSTCD, DNQTCD, DNNWCD FROM TSBSG.AUTDNDF00 ) AS T2 ON T1.MAMAPC = T2.DNMAPC AND T1.MASSCD = T2.DNSTCD AND T1.MAMAI1 = T2.DNQTCD AND T1.MAMALU = 'TSBG' AND T1.MAICDT <= (((Select Current date from SYSIBM.SYSDUMMY1) - T2.DNDURA days) - DATE('0001-01-01') + 10101) - 19000000 WHEN MATCHED THEN UPDATE SET T1.MASSCD = T2.DNNWCD" Also, i wanna commit these record as well, how can i do that
    105 pointsBadges:
    report
  • TomLiotta
    Why do you need to use a QMQRY for this? I can't see anything that needs a QMQRY. There are no variables and no formatted reporting output, so a basic source member for RUNSQLSTM would work fine. So the question still needs to e answered -- . Why do you want to do it with a QMQRY rather than with an alternative? . Technically, you could create a QM procedure that invokes both queries; but that's a much more detailed process. . Tom
    125,585 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