.Net Cobol

What is the difference is using data type condition-value vs type System.Boolean.  For example:

method-id btnSubmit_Click final private (sender as object e as type System.EventArgs).

local-storage section.
01 passwordStrength type Boolean.

invoke txtPassword::Text::IsStrongPassword returning passwordStrength.
evaluate passwordStrength
When false
invoke type MessageBox::Show("Please Enter A Stronger Password", "Password Error", type MessageBoxButtons::OK)
invoke txtPassword::Focus()
invoke txtPassword::Select(0, txtPassword::Text::Length)
when true
invoke LogUserInfo()
end-evaluate
end method.

The above gives me an error 'selection object does not match selection subject' in the evaluate statement.  But yet, when I change the local variable to condition-value instead of System.Boolean there is no error.

This is the called method and

method-id IsStrongPassword(s as string) returning strongpassword as type Boolean extension.
local-storage section.
Evaluate true
When type Regex::IsMatch(s, type HospitalManagementSoftware.Properties.Settings::Default::pwordchar)
set strongpassword to true
end method.

  • Verified Answer

    A condition-value is the predefined COBOL type that is mapped onto a Boolean. They should behave the same but it seems like the checker currently only recognizes the COBOL type within the evaluate statement. If you open up a support incident for this we can look into getting this changed.

    I can reproduce the problem simply with:

          01 bool1 type Boolean value true.
          01 cond-val condition-value value true.
          procedure division.

             evaluate bool1
                when true     *> This will be in error
                   display "true"
             end-evaluate.

             evaluate cond-val
                when true    *> This works
                   display "true"
             end-evaluate.