• If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Announcement

Collapse
No announcement yet.

checking for null value

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • checking for null value

    How would I check for a null value in the EXNABVAL program. If I have a field that can be null how would I code the program to check for it ?

  • #2
    I just created a quick test and it appears the front-end will treat it as blank or 0 (if numeric). The front-end does not allow the user to enter in a "null" value so you would check for blank or 0 depending on the field type.

    Comment


    • #3
      What if the field was a Date field ?

      Comment


      • #4
        Then it will be 0001-01-01

        Comment


        • #5
          How would you code the value in an SQL statement. When I put it in the format below I am getting an error.

          xec sql
          SELECT COUNT(*) INTO :count
          FROM MSTGLBKRH
          WHERE bhmaj = :abhmaj and bhmin = :abhmin and
          bhacct = :abhacct
          and bhco = :companyId
          and bhdiv = :divisionId
          and (bhrdat= :'0001-01-01'
          or bhdate> :abhdate);



          5770ST1 V7R4M0 190621 Create SQL ILE RPG Object GL40VAL
          DIAGNOSTIC MESSAGES
          MSG ID SEV RECORD TEXT
          SQL0104 30 2964 Position 37 Token '0001-01-01' was not valid. Valid
          tokens: <IDENTIFIER>.

          Comment


          • #6
            You shouldn't put a colon in front of any hard coded values. So remove the colon before '0001-01-01' and you should be okay.

            Comment

            Working...
            X