Help with converting legacy code

Hi there,
I am trialling Visual Cobol and because I don't have the manuals would like to know if somebody can help convert the following bits of legacy code which are throwing up "unknown type *OLE" errors.
Many thanks,
Greg.


000350 ENVIRONMENT DIVISION.
000360 CONFIGURATION SECTION.
000410 SPECIAL-NAMES.
000420                 ENVIRONMENT-NAME   IS NT-ENV-NAME
000430                 ENVIRONMENT-VALUE  IS NT-ENV-VALUE
000440                 CONSOLE IS CONS-1.
000450 REPOSITORY.
000460                 CLASS OLE AS '*OLE'.
...


001220       MOVE  '0'               TO  SSV743-USER.
001230       MOVE  'SSV743.CLASS1'   TO  SSV743-INVOKE-STRING.
001240       INVOKE OLE 'CREATE-OBJECT' USING SSV743-INVOKE-STRING
001250                                   RETURNING SSV743-RET-STRING.
001260       MOVE  'R'               TO  SSV743-FUNCTION.
001270       INVOKE  SSV743-RET-STRING 'LOADSETTINGS' USING
001280**                                 SSV743-FUNCTION
001290                                   SSV743-USER.

  • From what product are you converting this code? This is similar to the syntax supported in Net Express native programs for invoking COM objects but I have never seen anything look quite like this.

    Are you trying to invoke a COM class called SSV743.CLASS1 or do you perhaps have an OO COBOL class with the name of OLE?

    In Net Express or Visual COBOL native programs the syntax to call a COM class would look more like:

          class-control.

              MSExcel is class "$OLE$Excel.Application".

          working-storage section.

          01 ExcelObject          object reference.

          01 WorkBooksCollection  object reference.

          01 WorkBook             object reference.

          procedure division.

         *>   Create a new instance of Microsoft Excel

              invoke MSExcel "new" returning ExcelObject

         *>   Make Excel visible

              invoke ExcelObject "setVisible" using by value 1

         *>   Get the collection of WorkBooks

              invoke ExcelObject "getWorkBooks"

                  returning WorkBooksCollection

         *>   Add a new WorkBook to the collection

              invoke WorkBooksCollection "Add"

                  returning WorkBook

    This snippet is from a Net Express demo program that accesses the Excel server.

    We no longer document this approach in Visual COBOL but it is still supported.

    The Docs can still be found on-line for Net Express here:

  • Apologies. The complier was complaining about the unknown type, but the problem was actually with my project References not set correctly.
  • Thanks Chris, I solved the problem. I need to motivate that no changes will be required in moving over from our old Fujitsu Compiler so do not want to make ANY changes to the code.

    The documentation that you linked is very useful and will definately use it for reference going forward....

    Greg.