Skip to main content

Method to determine if an object-reference is set to an object

  • February 15, 2013
  • 0 replies
  • 0 views

Problem:

Receving a not found error when doing a invoke such as:-

               invoke wordserver "GetSpellingSuggestions"

                       using       ws-work

                       returning   ws-suggestion

Resolution:

The problem here is in the method name "GetSpellingSuggestions".

This has "get" as the first 3 characters so the COBOL OLE runtime thinks you want to get a property "SpellingSuggestions" rather than do a method call.

You can fix this by making a "setdispatchtype" call to tell the runtime that the next call is actually a method call and not a property fetch.

If you use code such as:-

         ******************************************************************

         *    Problem is due to the Method having "Get". Net Express

         *    assumes it is a Property fetch hence it fails.

         *    Can use "SetDispatchType" to tell OLE runtime that its

         *    a Method call.

         ******************************************************************

               invoke olesup "SetDispatchType" using by value 0

               invoke wordserver "GetSpellingSuggestions"

                       using       ws-work

                       returning   ws-suggestion

The the call should work correctly.

Old KB# 5411

0 replies

Be the first to reply!