Skip to main content

How to debug code when ACUCOBOL call Excel?

  • March 9, 2011
  • 16 replies
  • 0 views

[Migrated content. Thread originally posted on 08 March 2011]

I use EXCEL in my acuCOBOL code.
But when I tried to debug my code, I could not continue after line

CREATE @Application OF @Excel HANDLE IN EX-APP.
and I got ERROR-INFO-CODE = 8224.

I guess I need to add something in my "cblconfig" file for debugging, but what are they?

Thanks in advance.

16 replies

  • Author
  • Rocketeer
  • 19312 replies
  • March 9, 2011

[Migrated content. Thread originally posted on 08 March 2011]

I use EXCEL in my acuCOBOL code.
But when I tried to debug my code, I could not continue after line

CREATE @Application OF @Excel HANDLE IN EX-APP.
and I got ERROR-INFO-CODE = 8224.

I guess I need to add something in my "cblconfig" file for debugging, but what are they?

Thanks in advance.

Are you stepping through code in the runtime debugger, or using some other method?

As you mention ERROR-INFO-CODE, I'll guess your program has gone into declaratives and made a call to C$EXCEPINFO. But a value of 8224 (in any field) is usually a sign of having SPACES in a 2-byte binary field (ERROR-INFO-CODE should be defined as USAGE UNSIGNED-SHORT). You typically would never move spaces to such a field, so this typically happens when the field is in its initial state (which, by default, is spaces).

SPACES == 2020 (hexadecimal) == 8224 (decimal)




  • Author
  • Rocketeer
  • 19312 replies
  • March 10, 2011

[Migrated content. Thread originally posted on 08 March 2011]

I use EXCEL in my acuCOBOL code.
But when I tried to debug my code, I could not continue after line

CREATE @Application OF @Excel HANDLE IN EX-APP.
and I got ERROR-INFO-CODE = 8224.

I guess I need to add something in my "cblconfig" file for debugging, but what are they?

Thanks in advance.

Normally, when a class is not registered the error code returned should be:

0x80040154 (0x denotes the number is in hex).

After you have executed the call to C$EXCEPINFO, this should be the number when the error is that the class doesn't exist, not sure why you get another number.

There is a predefine for this in the def directory of your installation, in the file activex.def, it is named ACU-E-CLASSNOTREGISTERED.

Here is an example of a generic exception handler:

       declaratives.
       object-exception section.
           use after exception on object.
       object-exception-handler.
           call "c$excepinfo" using
                error-info
                error-source
                error-description
                error-help-file
                error-help-context.
           evaluate true
             when acu-e-classnotregistered
               display message box "Class not registered"
             when acu-e-initialstate
               display message box "INITIAL-STATE"
           end-evaluate.
           if error-help-file = spaces then
             display message box error-description
               title error-source
               icon mb-error-icon
           else
             display message box error-description h'0d'
               "Do you want help ?"
               title error-source
               icon mb-error-icon
               type is mb-yes-no
               default is mb-yes
               giving choice
             if choice = 1 then
               call "$winhelp" using error-help-file,
                    help-context
                 error-help-context
             end-if
           end-if
       end declaratives.

  • Author
  • Rocketeer
  • 19312 replies
  • March 10, 2011

[Migrated content. Thread originally posted on 08 March 2011]

I use EXCEL in my acuCOBOL code.
But when I tried to debug my code, I could not continue after line

CREATE @Application OF @Excel HANDLE IN EX-APP.
and I got ERROR-INFO-CODE = 8224.

I guess I need to add something in my "cblconfig" file for debugging, but what are they?

Thanks in advance.

Normally, when a class is not registered the error code returned should be:

0x80040154 (0x denotes the number is in hex).

After you have executed the call to C$EXCEPINFO, this should be the number when the error is that the class doesn't exist, not sure why you get another number.

There is a predefine for this in the def directory of your installation, in the file activex.def, it is named ACU-E-CLASSNOTREGISTERED.

Here is an example of a generic exception handler:

       declaratives.
       object-exception section.
           use after exception on object.
       object-exception-handler.
           call "c$excepinfo" using
                error-info
                error-source
                error-description
                error-help-file
                error-help-context.
           evaluate true
             when acu-e-classnotregistered
               display message box "Class not registered"
             when acu-e-initialstate
               display message box "INITIAL-STATE"
           end-evaluate.
           if error-help-file = spaces then
             display message box error-description
               title error-source
               icon mb-error-icon
           else
             display message box error-description h'0d'
               "Do you want help ?"
               title error-source
               icon mb-error-icon
               type is mb-yes-no
               default is mb-yes
               giving choice
             if choice = 1 then
               call "$winhelp" using error-help-file,
                    help-context
                 error-help-context
             end-if
           end-if
       end declaratives.

  • Author
  • Rocketeer
  • 19312 replies
  • March 10, 2011

[Migrated content. Thread originally posted on 08 March 2011]

I use EXCEL in my acuCOBOL code.
But when I tried to debug my code, I could not continue after line

CREATE @Application OF @Excel HANDLE IN EX-APP.
and I got ERROR-INFO-CODE = 8224.

I guess I need to add something in my "cblconfig" file for debugging, but what are they?

Thanks in advance.

Normally, when a class is not registered the error code returned should be:

0x80040154 (0x denotes the number is in hex).

After you have executed the call to C$EXCEPINFO, this should be the number when the error is that the class doesn't exist, not sure why you get another number.

There is a predefine for this in the def directory of your installation, in the file activex.def, it is named ACU-E-CLASSNOTREGISTERED.

Here is an example of a generic exception handler:

       declaratives.
       object-exception section.
           use after exception on object.
       object-exception-handler.
           call "c$excepinfo" using
                error-info
                error-source
                error-description
                error-help-file
                error-help-context.
           evaluate true
             when acu-e-classnotregistered
               display message box "Class not registered"
             when acu-e-initialstate
               display message box "INITIAL-STATE"
           end-evaluate.
           if error-help-file = spaces then
             display message box error-description
               title error-source
               icon mb-error-icon
           else
             display message box error-description h'0d'
               "Do you want help ?"
               title error-source
               icon mb-error-icon
               type is mb-yes-no
               default is mb-yes
               giving choice
             if choice = 1 then
               call "$winhelp" using error-help-file,
                    help-context
                 error-help-context
             end-if
           end-if
       end declaratives.

  • Author
  • Rocketeer
  • 19312 replies
  • March 11, 2011

[Migrated content. Thread originally posted on 08 March 2011]

I use EXCEL in my acuCOBOL code.
But when I tried to debug my code, I could not continue after line

CREATE @Application OF @Excel HANDLE IN EX-APP.
and I got ERROR-INFO-CODE = 8224.

I guess I need to add something in my "cblconfig" file for debugging, but what are they?

Thanks in advance.

Are you stepping through code in the runtime debugger, or using some other method?

Yes, I am stepping through code in the Source Debugging.


As you mention ERROR-INFO-CODE, I'll guess your program has gone into declaratives and made a call to C$EXCEPINFO.

Yes,Exactly my code has gone into declaratives.



Let me explain you my scenario in detail:

In my code, I want to test if Microsoft Application Excel is installed/available in the PC.
So I use "CREATE @Application OF@Excel" to do a test,
if code can create Excel application successfully,
then
Excel is installed
else
Excel is not installed
end-if.



In fact, Excel is installed on my PC.
073109 CHECK-EXCEL-INSTALLED.
073109     MOVE "Y" TO WS-EXCEL-INSTALLED.
072909     CREATE @Application OF @Excel HANDLE IN EX-APP.
080309     IF WS-EXCEL-INSTALLED = "Y" THEN
072909       MODIFY EX-APP @Workbooks::Add() GIVING EX-WORKBOOK
072909       DESTROY EX-WORKBOOK
072909       MODIFY EX-APP @Quit()
072909       DESTROY EX-APP
080309     ELSE
080309       CONTINUE
080309     END-IF.
073109 CHECK-EXCEL-INSTALLED-EXIT.
073109     EXIT.


And in declaratives, I MOVE "N" to flag variable WS-EXCEL-INSTALLED.

073109 OBJECT-EXCEPTION-HANDLING SECTION.
073109     USE AFTER EXCEPTION ON OBJECT.
073109 OBJECT-EXCEPTION-HANDLER.
073109     MOVE "N" TO WS-EXCEL-INSTALLED.
093009*     OPEN EXTEND CNTLOG.
           CALL "C$EXCEPINFO" USING ERROR-INFO, ERR-SOURCE, 
                                    ERR-DESCRIPTION, ERR-HELP-FILE, 
                                    ERR-HELP-CONTEXT.
      *     MOVE SPACES TO CNTLOG-RECORD.
      *     PERFORM PRINT-ERROR-CODE
093009*     THRU PRINT-ERROR-CODE-EXIT.
      *     MOVE ERROR-INFO TO WS-ERROR-CODE.
      *     STRING "ERROR-INFO = "
      *            WS-ERROR-CODE
      *            "; "
      *            "ERR-SOURCE = "
      *            ERR-SOURCE
      *            "; "
      *            "ERR-DESCRIPTION = "
      *            ERR-DESCRIPTION
      *            "; "
      *            "ERR-HELP-FILE = "
      *            ERR-HELP-FILE
      *            "."
      *     DELIMITED BY SIZE
      *     INTO CNTLOG-RECORD
      *     END-STRING.
      *     WRITE CNTLOG-RECORD.
      *     MOVE SPACES TO CNTLOG-RECORD.
      *     CLOSE CNTLOG.
      *     EXIT PROGRAM.
093009*     STOP RUN.
003460 END DECLARATIVES.


As you can see, I call "C$EXCEPINFO" in decaratives
           
            CALL "C$EXCEPINFO" USING ERROR-INFO, ERR-SOURCE, 
                                     ERR-DESCRIPTION, ERR-HELP-FILE, 
                                     ERR-HELP-CONTEXT.


In my last post, I said ERROR-INFO-CODE = 8224, that is because I was blocked the above lines. And ERROR-INFO-CODE is the initial value "8224"(Your analysis is correct).

Today,I unblock the above lines and re-run debugging of my code.
When debugger stepped to line
072909     CREATE @Application OF @Excel HANDLE IN EX-APP.
The debugger screen was frozen for a while, and then it stepped to declaratives and call "C$EXECPINFO",, I got the following information:
ERROR-INFO: "...€...." (DISPLAY IN HEX == "05000880 08000500" )
ERROR-SOURCE:"System Exception"
ERR-DESCRIPTION:"Server execution failed"
ERR-HELP-FILE: " "
ERR-HELP-CONTEXT:0

Could you help find out what my code problem is from the above?

Appreciate!










Chuck Edgin originally wrote:
Are you stepping through code in the runtime debugger, or using some other method?

As you mention ERROR-INFO-CODE, I'll guess your program has gone into declaratives and made a call to C$EXCEPINFO. But a value of 8224 (in any field) is usually a sign of having SPACES in a 2-byte binary field (ERROR-INFO-CODE should be defined as USAGE UNSIGNED-SHORT). You typically would never move spaces to such a field, so this typically happens when the field is in its initial state (which, by default, is spaces).

SPACES == 2020 (hexadecimal) == 8224 (decimal)








  • Author
  • Rocketeer
  • 19312 replies
  • March 11, 2011

[Migrated content. Thread originally posted on 08 March 2011]

I use EXCEL in my acuCOBOL code.
But when I tried to debug my code, I could not continue after line

CREATE @Application OF @Excel HANDLE IN EX-APP.
and I got ERROR-INFO-CODE = 8224.

I guess I need to add something in my "cblconfig" file for debugging, but what are they?

Thanks in advance.

Are you stepping through code in the runtime debugger, or using some other method?

Yes, I am stepping through code in the Source Debugging.


As you mention ERROR-INFO-CODE, I'll guess your program has gone into declaratives and made a call to C$EXCEPINFO.

Yes,Exactly my code has gone into declaratives.



Let me explain you my scenario in detail:

In my code, I want to test if Microsoft Application Excel is installed/available in the PC.
So I use "CREATE @Application OF@Excel" to do a test,
if code can create Excel application successfully,
then
Excel is installed
else
Excel is not installed
end-if.



In fact, Excel is installed on my PC.
073109 CHECK-EXCEL-INSTALLED.
073109     MOVE "Y" TO WS-EXCEL-INSTALLED.
072909     CREATE @Application OF @Excel HANDLE IN EX-APP.
080309     IF WS-EXCEL-INSTALLED = "Y" THEN
072909       MODIFY EX-APP @Workbooks::Add() GIVING EX-WORKBOOK
072909       DESTROY EX-WORKBOOK
072909       MODIFY EX-APP @Quit()
072909       DESTROY EX-APP
080309     ELSE
080309       CONTINUE
080309     END-IF.
073109 CHECK-EXCEL-INSTALLED-EXIT.
073109     EXIT.


And in declaratives, I MOVE "N" to flag variable WS-EXCEL-INSTALLED.

073109 OBJECT-EXCEPTION-HANDLING SECTION.
073109     USE AFTER EXCEPTION ON OBJECT.
073109 OBJECT-EXCEPTION-HANDLER.
073109     MOVE "N" TO WS-EXCEL-INSTALLED.
093009*     OPEN EXTEND CNTLOG.
           CALL "C$EXCEPINFO" USING ERROR-INFO, ERR-SOURCE, 
                                    ERR-DESCRIPTION, ERR-HELP-FILE, 
                                    ERR-HELP-CONTEXT.
      *     MOVE SPACES TO CNTLOG-RECORD.
      *     PERFORM PRINT-ERROR-CODE
093009*     THRU PRINT-ERROR-CODE-EXIT.
      *     MOVE ERROR-INFO TO WS-ERROR-CODE.
      *     STRING "ERROR-INFO = "
      *            WS-ERROR-CODE
      *            "; "
      *            "ERR-SOURCE = "
      *            ERR-SOURCE
      *            "; "
      *            "ERR-DESCRIPTION = "
      *            ERR-DESCRIPTION
      *            "; "
      *            "ERR-HELP-FILE = "
      *            ERR-HELP-FILE
      *            "."
      *     DELIMITED BY SIZE
      *     INTO CNTLOG-RECORD
      *     END-STRING.
      *     WRITE CNTLOG-RECORD.
      *     MOVE SPACES TO CNTLOG-RECORD.
      *     CLOSE CNTLOG.
      *     EXIT PROGRAM.
093009*     STOP RUN.
003460 END DECLARATIVES.


As you can see, I call "C$EXCEPINFO" in decaratives
           
            CALL "C$EXCEPINFO" USING ERROR-INFO, ERR-SOURCE, 
                                     ERR-DESCRIPTION, ERR-HELP-FILE, 
                                     ERR-HELP-CONTEXT.


In my last post, I said ERROR-INFO-CODE = 8224, that is because I was blocked the above lines. And ERROR-INFO-CODE is the initial value "8224"(Your analysis is correct).

Today,I unblock the above lines and re-run debugging of my code.
When debugger stepped to line
072909     CREATE @Application OF @Excel HANDLE IN EX-APP.
The debugger screen was frozen for a while, and then it stepped to declaratives and call "C$EXECPINFO",, I got the following information:
ERROR-INFO: "...€...." (DISPLAY IN HEX == "05000880 08000500" )
ERROR-SOURCE:"System Exception"
ERR-DESCRIPTION:"Server execution failed"
ERR-HELP-FILE: " "
ERR-HELP-CONTEXT:0

Could you help find out what my code problem is from the above?

Appreciate!










Chuck Edgin originally wrote:
Are you stepping through code in the runtime debugger, or using some other method?

As you mention ERROR-INFO-CODE, I'll guess your program has gone into declaratives and made a call to C$EXCEPINFO. But a value of 8224 (in any field) is usually a sign of having SPACES in a 2-byte binary field (ERROR-INFO-CODE should be defined as USAGE UNSIGNED-SHORT). You typically would never move spaces to such a field, so this typically happens when the field is in its initial state (which, by default, is spaces).

SPACES == 2020 (hexadecimal) == 8224 (decimal)








  • Author
  • Rocketeer
  • 19312 replies
  • March 11, 2011

[Migrated content. Thread originally posted on 08 March 2011]

I use EXCEL in my acuCOBOL code.
But when I tried to debug my code, I could not continue after line

CREATE @Application OF @Excel HANDLE IN EX-APP.
and I got ERROR-INFO-CODE = 8224.

I guess I need to add something in my "cblconfig" file for debugging, but what are they?

Thanks in advance.

I verified activex.def for both acu6.10 and acu8.11
In acu8.11, I see

* Class not registered
               88  ACU-E-CLASSNOTREGISTERED          VALUE 340.


But in acu6.10, I don't.

Actually the above debugging was done under acu6.10.

From your comment, I think you suspect this was caused by "not registered class".
If so, how should I do to register the required class?
And why does my code have this error only under debugging mode?
I could run this code without any problem if not under debugging mode.

  • Author
  • Rocketeer
  • 19312 replies
  • March 11, 2011

[Migrated content. Thread originally posted on 08 March 2011]

I use EXCEL in my acuCOBOL code.
But when I tried to debug my code, I could not continue after line

CREATE @Application OF @Excel HANDLE IN EX-APP.
and I got ERROR-INFO-CODE = 8224.

I guess I need to add something in my "cblconfig" file for debugging, but what are they?

Thanks in advance.

I verified activex.def for both acu6.10 and acu8.11
In acu8.11, I see

* Class not registered
               88  ACU-E-CLASSNOTREGISTERED          VALUE 340.


But in acu6.10, I don't.

Actually the above debugging was done under acu6.10.

From your comment, I think you suspect this was caused by "not registered class".
If so, how should I do to register the required class?
And why does my code have this error only under debugging mode?
I could run this code without any problem if not under debugging mode.

  • Author
  • Rocketeer
  • 19312 replies
  • March 14, 2011

[Migrated content. Thread originally posted on 08 March 2011]

I use EXCEL in my acuCOBOL code.
But when I tried to debug my code, I could not continue after line

CREATE @Application OF @Excel HANDLE IN EX-APP.
and I got ERROR-INFO-CODE = 8224.

I guess I need to add something in my "cblconfig" file for debugging, but what are they?

Thanks in advance.

I never heard of a case where a connection to a COM object fails to establish when running debug mode, that is odd.
I was about to suggest you raise a RPI for this, but 6.1 is long gone. You should upgrade to a more recent version.

As for registering the class, that is something you have to look at the documentation from the vendor of the particular object for. Once you know this, you can do registration from the declaratives section.

  • Author
  • Rocketeer
  • 19312 replies
  • March 14, 2011

[Migrated content. Thread originally posted on 08 March 2011]

I use EXCEL in my acuCOBOL code.
But when I tried to debug my code, I could not continue after line

CREATE @Application OF @Excel HANDLE IN EX-APP.
and I got ERROR-INFO-CODE = 8224.

I guess I need to add something in my "cblconfig" file for debugging, but what are they?

Thanks in advance.

I never heard of a case where a connection to a COM object fails to establish when running debug mode, that is odd.
I was about to suggest you raise a RPI for this, but 6.1 is long gone. You should upgrade to a more recent version.

As for registering the class, that is something you have to look at the documentation from the vendor of the particular object for. Once you know this, you can do registration from the declaratives section.

  • Author
  • Rocketeer
  • 19312 replies
  • March 14, 2011

[Migrated content. Thread originally posted on 08 March 2011]

I use EXCEL in my acuCOBOL code.
But when I tried to debug my code, I could not continue after line

CREATE @Application OF @Excel HANDLE IN EX-APP.
and I got ERROR-INFO-CODE = 8224.

I guess I need to add something in my "cblconfig" file for debugging, but what are they?

Thanks in advance.

I never heard of a case where a connection to a COM object fails to establish when running debug mode, that is odd.
I was about to suggest you raise a RPI for this, but 6.1 is long gone. You should upgrade to a more recent version.

As for registering the class, that is something you have to look at the documentation from the vendor of the particular object for. Once you know this, you can do registration from the declaratives section.

  • Author
  • Rocketeer
  • 19312 replies
  • March 14, 2011

[Migrated content. Thread originally posted on 08 March 2011]

I use EXCEL in my acuCOBOL code.
But when I tried to debug my code, I could not continue after line

CREATE @Application OF @Excel HANDLE IN EX-APP.
and I got ERROR-INFO-CODE = 8224.

I guess I need to add something in my "cblconfig" file for debugging, but what are they?

Thanks in advance.

Similar things have happened to me with using COM and Microsoft products. Try going into Excel and use the option "Detect & Repair" or something similar (depending on your version of Excel).

  • Author
  • Rocketeer
  • 19312 replies
  • March 14, 2011

[Migrated content. Thread originally posted on 08 March 2011]

I use EXCEL in my acuCOBOL code.
But when I tried to debug my code, I could not continue after line

CREATE @Application OF @Excel HANDLE IN EX-APP.
and I got ERROR-INFO-CODE = 8224.

I guess I need to add something in my "cblconfig" file for debugging, but what are they?

Thanks in advance.

Similar things have happened to me with using COM and Microsoft products. Try going into Excel and use the option "Detect & Repair" or something similar (depending on your version of Excel).

  • 0 replies
  • March 17, 2011

[Migrated content. Thread originally posted on 08 March 2011]

I use EXCEL in my acuCOBOL code.
But when I tried to debug my code, I could not continue after line

CREATE @Application OF @Excel HANDLE IN EX-APP.
and I got ERROR-INFO-CODE = 8224.

I guess I need to add something in my "cblconfig" file for debugging, but what are they?

Thanks in advance.

I hate to hijack the thread, but it is related. We use acubench and we want to make use of this. Where can we insert these declaratives in acubench (using 8.1.3)? we can add declaratives for files, but I see no place to add them for activeX components. I thought maybe I could enter it directly in the .cbl file, but I cannot because the acubench tags surround the entire declarative section...

Any ideas on how to accomplish this using acubench?


OBJECT-EXCEPTION-HANDLING SECTION. 
USE AFTER EXCEPTION ON OBJECT.
OBJECT-EXCEPTION-HANDLER.

  • Author
  • Rocketeer
  • 19312 replies
  • June 30, 2011

[Migrated content. Thread originally posted on 08 March 2011]

I use EXCEL in my acuCOBOL code.
But when I tried to debug my code, I could not continue after line

CREATE @Application OF @Excel HANDLE IN EX-APP.
and I got ERROR-INFO-CODE = 8224.

I guess I need to add something in my "cblconfig" file for debugging, but what are they?

Thanks in advance.

Cheesle originally wrote:
I never heard of a case where a connection to a COM object fails to establish when running debug mode, that is odd.
I was about to suggest you raise a RPI for this, but 6.1 is long gone. You should upgrade to a more recent version.

As for registering the class, that is something you have to look at the documentation from the vendor of the particular object for. Once you know this, you can do registration from the declaratives section.



I do debug with "8.11", there is not this issue.

So it should be the "6.1" defect.

  • Author
  • Rocketeer
  • 19312 replies
  • June 30, 2011

[Migrated content. Thread originally posted on 08 March 2011]

I use EXCEL in my acuCOBOL code.
But when I tried to debug my code, I could not continue after line

CREATE @Application OF @Excel HANDLE IN EX-APP.
and I got ERROR-INFO-CODE = 8224.

I guess I need to add something in my "cblconfig" file for debugging, but what are they?

Thanks in advance.

Cheesle originally wrote:
I never heard of a case where a connection to a COM object fails to establish when running debug mode, that is odd.
I was about to suggest you raise a RPI for this, but 6.1 is long gone. You should upgrade to a more recent version.

As for registering the class, that is something you have to look at the documentation from the vendor of the particular object for. Once you know this, you can do registration from the declaratives section.



I do debug with "8.11", there is not this issue.

So it should be the "6.1" defect.