Highlighted
Contributor.
Contributor.
814 views

.Net Cobol

Jump to solution

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.

0 Likes
1 Solution

Accepted Solutions
Highlighted
Micro Focus Expert
Micro Focus Expert

RE: .Net Cobol

Jump to solution

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.

View solution in original post

0 Likes
1 Reply
Highlighted
Micro Focus Expert
Micro Focus Expert

RE: .Net Cobol

Jump to solution

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.

View solution in original post

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.