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


  • Subject: RE: RPG - conversion vs re-write
  • From: "Hans Boldt" <hboldt@xxxxxxxxxxxx>
  • Date: Thu, 11 Sep 97 08:55:56 EDT

Bob Cozzi <BobCozzi@ibm.net> wrote
>Okay, here's some code that saves absolutely nothing, but is more
>English-like that %NULLID(ddd)=*ON
>
>
>     D IsNULL          PR             1S 0
>     D   TestDate                      L   Const
>
>     PIsNULL           B                   Export
>     D IsNull          PI             1S 0
>     D  TestDate                       L   Const
>     C                   Return    (%NULLID(TestDate)=*ON)
>     PIsNULL           E
>
>Using this procedure, you can then do this in Calcs
>
>C                  If            IsNull(MyDateFld)
>C                  /*  do your null-date routine here */
>C                  endif
>
>
>This would be the same as:
>
>C                  If            %NullID(MyDateFld)=*ON
>C                  /*  do your null-date routine here */
>C                  endif
>
>
>Now, I suppose the thing that might byte me is the return type on the
>procedures. I used a 1-digit signed numeric. I don't know if Indicators can
>automatically be cast to zoned decimals, so if it doesn't work, do a Z-ADD
>deal right before the return, or similar.


Bob:  Have you actually tried coding this?  Here's a hint:  It won't
compile!  The expression in the IF statement must return an indicator
value.  Your procedure "IsNULL" returns a numeric value.

Here's another hint:  Since the built-in function %NULLIND returns an
indicator value, you just have to code:

          C                 IF        %NULLIND(MyDateField)
          C                   /* stuff */
          C                 ENDIF

(This is described on page 342 of the RPG Reference Manual.)

Cheers!  Hans

Hans Boldt, ILE RPG Development, IBM Toronto Lab, hboldt@vnet.ibm.com
+---
| This is the Midrange System Mailing List!
| To submit a new message, send your mail to "MIDRANGE-L@midrange.com".
| To unsubscribe from this list send email to MAJORDOMO@midrange.com
|    and specify 'unsubscribe MIDRANGE-L' in the body of your message.
| Questions should be directed to the list owner/operator: david@midrange.com
+---


As an Amazon Associate we earn from qualifying purchases.

This thread ...


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.