.Net Cobol

In looking at the evaluate statement for the button click event, why does the evaluate txtEmailAddress::text::IsValidEmail() produce an error selection object does not match selection subject.  I put the set and evaluate validEmail in to show that it works.  I was trying to combine statements like you can do in C#.
 
method-id btnSubmit_Click final private (sender as object e as type System.EventArgs).
       local-storage section.
       01  validEmail type System.Boolean.
       
*       set validEmail = txtEmailAddress::Text::IsValidEmail()
*       evaluate validEmail
       
         evaluate txtEmailAddress::Text::IsValidEmail()
         when true
         //some code
         when false
         //some code
       end-evaluate
end method.
 
method-id IsValidEmail(s as string) returning validEmail as type Boolean extension
       local-storage section.
       try
           declare mailAddress = new type System.Net.Mail.MailAddress(s)
           set validEmail = true
       catch
           set validEmail = false
       end method.
  • Verified Answer

    Development has found this to be a problem with how the compiler recognizes the Boolean type within the evaluate statement and the problem has now been addressed in our next major product release VC 3.0 which will be delivered later this year. If you could open up a support incident with Customer Care and include my name in the description then I will add the incident to the problem report so that you will be notified when the fix is available.

    The workaround right now would be to break up the statement like you demonstrate and use only a data-item defined as a condition-value or a System.Boolean (full namespace) as the subject of the evaluate.
    The alternative is to use an if statement which can handle the full expression without a problem.
    if txtEmailAddress::Text::IsValidEmail()
    *>some code
    else
    *>some code
    end-if