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



Thanks all for your help. Thanks to John M. for putting me on the right
path (or at leasst one of the few I am sure). Since my TAXC05 field is
allowed to be null, this is what I did.

Defined a variable in D spec for nulls
D NullInds s 5i 0 dim(6)

Then added to FETCH behind the field that is allowed to be null. NOTICE
NO COMMA BETWEEN :TAXC05 and :NULLINDS

C/EXEC SQL
C+ FETCH NEXT FROM C1 INTO
C+ :CONO15,:PLNO15,:WONO15,:MQTY15,:MOVC15,:ACCN15,:TRND15,
C+ :MOVT15,:PNVM15,:PDES15,:PERN15,
C+ :TAXC05 :NULLINDS
C/END-EXEC

Thanks again, and if anyone has any better suggestions for this I am all
ears or eyes anyway.


-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Maassel, John R
Sent: Thursday, July 22, 2010 12:40 PM
To: RPG programming on the IBM i / System i
Subject: RE: Embedded SQL - Join problems

A LEFT OUTER JOIN can allow nulls into the mix. Your FETCH doesn't look
it has null indicators for each field that can be null. When removing
the fields from the "right side" of the LEFT JOIN, you're not going to
have the problem. I usually don't use nulls so not sure what the syntax
for null indicators is. You might be able to find help from Google or
the SQL docs on that.

--
John Maassel
IBM i Programmer/Analyst
Bob Evans Farms, Inc
john_maassel@xxxxxxxxxxxx
614-492-7413

-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-
bounces@xxxxxxxxxxxx] On Behalf Of Shannon Wolf
Sent: Thursday, July 22, 2010 12:02 PM
To: RPG programming on the IBM i / System i
Subject: RE: Embedded SQL - Join problems

My apologies. The lines below with an "*-----" are the lines which I
can remove for the sql to perform as expected.

Thanks


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 WHERE A.CONO15 = '01'
C+ 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

-----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 WHERE A.CONO15 = '01'
C+ 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.

--
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 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 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 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.

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

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.