Yes I opened and close the cursor.
fWOP05U if e k disk
FWOP05UL1 IF E K DISK
F RENAME(WOR05U:WOR05UA)
C/EXEC SQL
C+ DECLARE C1 CURSOR FOR
C+ SELECT
C+ CONO15,PLNO15,WONO15,MQTY15,MOVC15,ACCN15,TRND15,
C+ MOVT15,PNVM15,PDES15,PERN15,
C+ CONO05,PLNO05,TAXC05-----------------------------If removed it works
C+ FROM WOP15U A
C+ LEFT OUTER JOIN
C+ WOP05U B ON
C+ A.CONO15 = B.CONO05 AND A.PLNO15 = B.PLNO05
C+ WHERE A.CONO15 = '01' AND
C+ A.MOVT15 = 'I' AND
C+ PERN15 >= :FRPRD AND PERN15 <= :TOPRD
C/END-EXEC
C/EXEC SQL
C+ OPEN C1
C/END-EXEC
C/EXEC SQL
C+ FETCH NEXT FROM C1 INTO
C+ :CONO15,:PLNO15,:WONO15,:MQTY15,:MOVC15,:ACCN15,:TRND15,
C+ :MOVT15,:PNVM15,:PDES15,:PERN15,
C+ :CONO05,:PLNO05,:TAXC05 ---------------------If removed it works.
C/END-EXEC
-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Needles,Stephen J
Sent: Thursday, July 22, 2010 11:51 AM
To: RPG programming on the IBM i / System i
Subject: RE: Embedded SQL - Join problems
Did you OPEN the cursor?
I couldn't see the highlighted code...must have been lost in
translation. Can you indicate it another way?
-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Shannon Wolf
Sent: Thursday, July 22, 2010 9:52 AM
To: rpg400-l@xxxxxxxxxxxx
Subject: Embedded SQL - Join problems
I am trying to use the following embedded sql code joining two files via
a left outer join. When I rmeove the highlighted code, I get the
results I am expecting, however, with the code inserted it doesn't
return any records, which tell sme there is probably some sort of syntax
issue. When I run the sql statement in SQL400 it is fine, and when I
run it through a third party SQL it runs fine. Please help.
fWOP05U if e k disk
FWOP05UL1 IF E K DISK
F RENAME(WOR05U:WOR05UA)
C/EXEC SQL
C+ DECLARE C1 CURSOR FOR
C+ SELECT
C+ CONO15,PLNO15,WONO15,MQTY15,MOVC15,ACCN15,TRND15,
C+ MOVT15,PNVM15,PDES15,PERN15,
C+ CONO05,PLNO05,TAXC05
C+ FROM WOP15U A
C+ LEFT OUTER JOIN
C+ WOP05U B ON
C+ A.CONO15 = B.CONO05 AND A.PLNO15 = B.PLNO05
C+ WHERE A.CONO15 = '01' AND
C+ A.MOVT15 = 'I' AND
C+ PERN15 >= :FRPRD AND PERN15 <= :TOPRD
C/END-EXEC
C/EXEC SQL
C+ FETCH NEXT FROM C1 INTO
C+ :CONO15,:PLNO15,:WONO15,:MQTY15,:MOVC15,:ACCN15,:TRND15,
C+ :MOVT15,:PNVM15,:PDES15,:PERN15,
C+ :CONO05,:PLNO05,:TAXC05
C/END-EXEC
**********************************************************************
This message, together with any attachments, may include proprietary and
confidential information of Ormet and is intended only for the person or
persons to whom it is addressed. If you are not the intended recipient,
you are hereby notified that any disclosure, copying, distribution, use,
or any action or reliance on this communication is strictly prohibited.
This document is not intended to operate as an electronic signature and
is not intended to form a binding contract unless it so expressly
states. If you have received this e-mail in error, please notify the
sender immediately by return e-mail and delete the message, along with
any attachments.
--
This is the RPG programming on the IBM i / System i (RPG400-L) mailing
list To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe,
unsubscribe, or change list options,
visit:
http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives at
http://archive.midrange.com/rpg400-l.
========================================================================
======
This communication, including attachments, is confidential, may be
subject to legal privileges, and is intended for the sole use of the
addressee. Any use, duplication, disclosure or dissemination of this
communication, other than by the addressee, is prohibited. If you have
received this communication in error, please notify the sender
immediately and delete or destroy this communication and all copies.
As an Amazon Associate we earn from qualifying purchases.