Skip to main content

I am getting the above error with Visual COBOL 2.0 that I didn't get with Visual COBOL R4. What am I missing?

Here's the line of code:

invoke cmd::Parameters::AddWithValue("@comm_term_vesting_pct", Convert::ToDecimal(comm-term-vesting-pct))

where comm-term-vesting-pct is defined as Pic 9(9)V9(2) COMP-3.

The error occurs whenever I try to convert to anything other than an interger or string.


#VisualCOBOL

I am getting the above error with Visual COBOL 2.0 that I didn't get with Visual COBOL R4. What am I missing?

Here's the line of code:

invoke cmd::Parameters::AddWithValue("@comm_term_vesting_pct", Convert::ToDecimal(comm-term-vesting-pct))

where comm-term-vesting-pct is defined as Pic 9(9)V9(2) COMP-3.

The error occurs whenever I try to convert to anything other than an interger or string.


#VisualCOBOL

Hi Noj, this looks like a bug in the compiler, we've raised an incident which we'll address in a coming release.

In the interim, could you see if this is an acceptable workaround for you:

      01 comm-term-vesting-pct Pic 9(9)V9(2) COMP-3.

      01 d decimal.

      procedure division.

          set d to comm-term-vesting-pct

          INVOKE cmd::AddWithValue("@comm_term_vesting_pct", d)

Regards, Scot