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



Eeewww. You have to know how many fields.

I'm using a cursor, so I've got this

D wmsupcNull S 5I 0 Dim(10)

D wmsupcDS E DS ExtName(WMSUPC)
D Inz
D Prefix(u)

D dmitmmstNull S 5I 0 Dim(143)

D dmitmmstDS E DS ExtName(DMITMMST)
D Inz
D Prefix(i)

the declare:

Exec SQL
Declare MyCursor cursor for
Select i.*,
dmitmmstNull,
u.*,
wmsupcNull
From WMSUPC u Full Outer
Join DMITMMST i ON u.UPITEM = i.ITNBR
Order By i.WHSLC,
i.ITNBR;

which barfs with
"SQL0206: Position 22 Column or global variable WMSUPCNULL not found."

and the fetch:

Exec SQL
Fetch Next from MyCursor
into :dmitmmstDS, :dmitmmstNull, :wmsupcDS, :wmsupcNull;

which also barfs with
"SQL0312: Position 34 Variable DMITMMSTNULL not defined or not usable.
Reason: The variable is a dimensioned array."
"SQL0312: Position 60 Variable WMSUPCNULL not defined or not usable.
Reason: The variable is a dimensioned array."

The "Database Embedded SQL Programming" does not have any RPG null example
that I can find.



On Wed, Feb 13, 2019 at 4:43 PM Alan Campin <alan0307d@xxxxxxxxx> wrote:

No, SQL reference.

D CustomerDS DS
D CustID 7P 0
D CustName 30A
D CustSales 7P 2

D CustomerInds S 5I 0 Dim(3)

D NullValue C -1

/Free

Exec SQL
Select CustID, CustName, CustSales
Into :CustomerDS :CustomerInds
From Customer
Where CustID = :InputCust;

If SQLState = '00000';

If CustomerInds(3) = NullValue;
PrintSales = 'No Sales';
Else;
PrintSales = ('Sales were $' + %Char(CustSales));
EndIf;
EndIf;


On Wed, Feb 13, 2019 at 1:37 PM Jeff Crosby <jlcrosby@xxxxxxxxxxxxxxxx>
wrote:

The RPG reference? OK, I'll look.

On Wed, Feb 13, 2019 at 4:34 PM Alan Campin <alan0307d@xxxxxxxxx> wrote:

Allow Null and %NullInd are for file I/O, not SQL.

In SQL you create array of small int, one for each field in the data
structure. If null, array element is set to non-zero. All described in
the
manuals.

On Wed, Feb 13, 2019 at 1:24 PM Jeff Crosby <jlcrosby@xxxxxxxxxxxxxxxx

wrote:

I'm doing an SQL full outer join of 2 files looking for exceptions
both
ways. The select is into data structures.

Obviously there will be instances where one or the other of the files
has
nothing so the DS fields will be null. I've got a ALWNULL(*USRCTL)
statement. I've got an If %Nullind (iITNBR) in the code.

The compiler barfs trying to put ALWNULL on the DS definition. How
do
I
specify ALWNULL on a DS? My googling skills are lacking today.

Thanks.

--


Jeff Crosby
VP Information Systems
UniPro FoodService/Dilgard
P.O. Box 13369
Ft. Wayne, IN 46868-3369
260-422-7531
direct.dilgardfoods.com

The opinions expressed are my own and not necessarily the opinion of
my
company. Unless I say so.
--
This is the RPG programming on the IBM i (AS/400 and iSeries)
(RPG400-L)
mailing list
To post a message email: RPG400-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxx for any subscription related
questions.

Help support midrange.com by shopping at amazon.com with our
affiliate
link: https://amazon.midrange.com

--
This is the RPG programming on the IBM i (AS/400 and iSeries)
(RPG400-L)
mailing list
To post a message email: RPG400-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxx for any subscription related
questions.

Help support midrange.com by shopping at amazon.com with our affiliate
link: https://amazon.midrange.com



--


Jeff Crosby
VP Information Systems
UniPro FoodService/Dilgard
P.O. Box 13369
Ft. Wayne, IN 46868-3369
260-422-7531
direct.dilgardfoods.com

The opinions expressed are my own and not necessarily the opinion of my
company. Unless I say so.
--
This is the RPG programming on the IBM i (AS/400 and iSeries) (RPG400-L)
mailing list
To post a message email: RPG400-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxx for any subscription related
questions.

Help support midrange.com by shopping at amazon.com with our affiliate
link: https://amazon.midrange.com

--
This is the RPG programming on the IBM i (AS/400 and iSeries) (RPG400-L)
mailing list
To post a message email: RPG400-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxx for any subscription related
questions.

Help support midrange.com by shopping at amazon.com with our affiliate
link: https://amazon.midrange.com




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.