Error 1 COBCH1624 : Cannot implicitly convert string to binary-long unsigned.

Hello. I'm starting to work with Visual Cobol but I'm an old programmer RM / COBOL and COBOL-WOW. If visual Cobol really Cobol, I know how to handle this new Cobol numeric fields and their masks.
Working Storage Section.

01 Campos.

     02 Sequence 02 pic 9 (9). 

     02 Amount pic S9 (9) V9 (2). 

     02 date.

          03 year pic 9 (4). 

          03 months pic 9 (2). 

          03 day pic 9 (2). 

     02 Sequence-z pic zzzzzzzzz.

    set amount TO TextBox17::Text().

Error 1 COBCH1624 : Cannot implicitly convert string to binary-long unsigned.

Error 4 COBCH0829 : Could not find method 'Amount' with this signature.

Please, let me know how visual Cobol, work it.

  • The Text property of a Textbox control is a string which cannot be directly moved into the amount field which is a numeric.

    The following should work but it assumes that the value entered is a valid numeric.

    You should check the field to not being blank beforehand.

       if TextBox17::Text not = ""

          set amount to type System.Convert::ToDecimal(self::TextBox17::Text)

       end-if

    You might also look at using the maskedTextBox control instead of the standard textBox so you can define the type of data that can be entered for these numeric fields.

  • Use TRY CATCH format::

              TRY                  

                set amount to type System.Convert::ToDecimal(self::TextBox17::Text)

              CATCH

                display "Value is not numeric"

              END-TRY

  • Not it doesn't work.

    Unhandled Exception:FormatException

    Input string was not in a correct format

    at Void System.Number.StringToNumber(System.String str, etc.

    In Cobol-wow to display a field numeric or not I use:

              CALL WOWSETPROP USING WIN-RETURN EDIT1-H "TEXT"

                   NUMERO-CW.

    and to get the value I use:

              CALL WOWGETPROP USING WIN-RETURN EDIT1-H "TEXT"

                   NUMERO-CW.

    That is simple and not errors. Why Visual Cobol doesn't have the simple solution, because to transformation of software that is very important.

  • Can you show me the exact statement that you are using on which you get this error?

    Also what is the value that you are entering in the field prior to the set statement?

    I am using the statement that I showed to you and it works fine.

    If you are looking for a way to convert an RM COBOL WOW application to Visual COBOL then you should talk to Bob England at ETS as he has created a tool which does exactly that.

    Thanks.

  • There are no errors if you use the tryparse for the conversion:

    If you expect a double:

          set Amount to 0.0  *> optional

          invoke type System.Decimal::TryParse(TextBox17::Text, by reference Amount)

    If you expect an integer:

          set Amount to 0  *> optional

          invoke type System.Int32::TryParse(TextBox17::Text, by reference Amount)

    Each numeric class has its own parse & try parse

  • There are no errors if you use the tryparse for the conversion:

    If you expect a double:

          set Amount to 0.0  *> optional

          invoke type System.Decimal::TryParse(TextBox17::Text, by reference Amount)

    If you expect an integer:

          set Amount to 0  *> optional

          invoke type System.Int32::TryParse(TextBox17::Text, by reference Amount)

    Each numeric class has its own parse & try parse

  • Hi Wascar,

    Thank you for your email.  I apologize that we are not in a position to help you in the way you request.  We spent about a year working out the details of how to effectively convert Wow programs to Visual Cobol and building the conversion tool to do it efficiently.  Unfortunately, it does not make business sense for our company to provide an example of how to conversion at a very low cost.

    Sincerely,

    ETS Sales

    From: Wascar Guerrero

    Sent: Wednesday, June 05, 2013 3:15 PM

    To: 'Bob England'

    Subject: RE: CoboWow to Visual Cobol

    Hi Bob.

    I have purchased Visual-Cobol but have been very difficult for me to study without a guide. I am a freelance programmer I have a small software Cobol-wow. I know I cannot afford the prices to convert my software, however, I attached a Cobol program very simple-wow and I want you to tell me how much I cost conversion to Cobol for Visual-I use it as a learning guide.

    Thank you.

    Wascar Guerrero.

  • Verified Answer

    Thank you all for trying to help. The reality is that visual cobol not yet ready to overcome the cobol as language, is painful but this effort needs to microfocus is sailing in the dark. Thanks for referring to Bob England, he is not an employee of MicroFocus and is responsible not help anyone. At the conference in Newark this year the biggest concern was the help and it seems that they were all right. Microfocus owns RM / COBOL, COBOL-WOW, and all CORPORANTION SOFTWARE LIANT products as well as ACUCOBOL, but apparently if you want to impose VISUAL COBOL will have to help us understand the structure and functionality of the new environment. We need a real solution with clear and well-documented examples of the fundamental things we can do in RMCOBOL cobol cobol or the new visual platform-cobol.

    Thanks.

    Wascar Guerrero.