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



Doug,

You could always define the parameter with *OMIT and/or *NOPASS. But
then your calling routine would have to make a check and omit the
parm.

Another option I've use to work around the fact that RPG doesn't have
full NULL support is to use data structures with a value field and a
null indicator field instead of variables made up of simple types.

d t_NullableDate ds TEMPLATE
d value d inz(*LOVAL)
d isNull n inz(*ON)

d myDate ds likeds(t_NullableDate) inz(*LIKEDS)

/free
chain key myFile;
myDate.value = FILEDATE;
myDate.isNull = %nullind(FILEDATE);

MyCoolProcedure(somedata:myDate);
/end-free

It works pretty well if you have the file i/o encapsulated, as you
only need to worry about converting between a simple date and a
"nullable date" and back once.

I've done the same thing with numerics and strings. Though with a
string you can simply use VARYING such that an empty string is NULL.

HTH,
Charles


On Thu, Dec 31, 2009 at 2:15 PM, Doug Palme <DPalme@xxxxxxxxxxx> wrote:
Hey Scott,
A thought just hit me, what if I passed in the keys for the data in the
original file, did a chain and then tested for the *NULLIND locally in the
procedure?

The only difference is I am adding some overhead for the file lookup local
to the procedure.

Thoughts?




From:   Scott Klement <rpg400-l@xxxxxxxxxxxxxxxx>
To:     RPG programming on the IBM i / System i <rpg400-l@xxxxxxxxxxxx>
Date:   12/31/2009 12:36 PM
Subject:        Re: Passing a Null Date to a Procedure
Sent by:        rpg400-l-bounces@xxxxxxxxxxxx



Hi Doug,

You need to declare options(*NULLIND) on the prototype.  When you do
that, RPG will automatically pass the null indicator with the parameter.

However, bear in mind that it's not possible to declare a field on
D-spec with a null indicator.  That means parameters passed to this
subprocedure have to be externally defined variables coming from
null-capable PFs declared on an F-spec.   That severely limits the
reusability of your subprocedure.  Personally I would give that a lot of
thought before using options(*NULLIIND)



Doug Palme wrote:
Is there any way to define a date value in a procedure interface as
being
null capable?

I have checked the reference manual and so far have come up empty handed

on this.

We have a file that allows for null capable dates and I have to pass
this
value to a procedure for some processing, but it does not like the usage

of the %NULLIND parm.

 *RNF0342 20      3 The parameter for %NULLIND is not valid; %NULLIND is

ignored

*RNF0342 20    259 008812  Parameter WENDDATE for %NULLIND is not null
capable
                           %NULLIND is ignored.

Suggestions?

Douglas





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



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.