× 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 -Reply
  • From: David Morris <dmorris@xxxxxxxxxxxxx>
  • Date: Thu, 11 Sep 1997 15:58:24 -0600



>>> "Hans Boldt" <hboldt@VNET.IBM.COM> 09/11 6:55 am >>>
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.)

Hans, 

Where do you get page numbers?

Even though the code won't compile  Mr. Cozzi's example would be a good
place to have OPTIONS(*VARTYPE: *VARSIZE), even without full operational
descriptor support.  It would be nice if *VARSIZE worked for numerics.

Your example works like a boolean value and is just great...but...somewhere
in the manual (no page numbers in mine) it says that character fields are
treated as boolean when they are used as the result of a comparison.   Why
can't the IF make that assumption?  IE:  IF ErrFlg, should work but gives a
compile error unless coded as IF ErrFlg = *ON.  If it shouldn't work why does
EVAL ErrFlg = A <> B work?

David Morris
+---
| 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.