Skip to main content

[archive] "CREATE" Statement

  • July 31, 2009
  • 1 reply
  • 0 views

[Migrated content. Thread originally posted on 31 July 2009]

Generally, we use

          CREATE @Application OF @Excel HANDLE IN EX-APP.


to create an application object. In this instance, we create an Excel object.

and the help document says

CREATE object-name
 
HANDLE { IN } object-handle
       { IS }
Remaining phrases are optional.

SERVER-NAME { IS } server-name
            { =  }
LICENSE-KEY { IS } license-key
            { =  }
EVENT PROCEDURE IS { proc-1 [ {THROUGH} proc-2 ] }
                              {THRU } 
                   { NULL } 



For the above instance, if EXCEL is not installed on the server, "CREATE" will return message like "Class not registered". I would like to catch the error return value, and then I could do error processing when error value returns.

Which parameter or variable does store the error return value?...

I guess "EX-APP" handle does it, but what values are they?...

1 reply

[Migrated content. Thread originally posted on 31 July 2009]

Generally, we use

          CREATE @Application OF @Excel HANDLE IN EX-APP.


to create an application object. In this instance, we create an Excel object.

and the help document says

CREATE object-name
 
HANDLE { IN } object-handle
       { IS }
Remaining phrases are optional.

SERVER-NAME { IS } server-name
            { =  }
LICENSE-KEY { IS } license-key
            { =  }
EVENT PROCEDURE IS { proc-1 [ {THROUGH} proc-2 ] }
                              {THRU } 
                   { NULL } 



For the above instance, if EXCEL is not installed on the server, "CREATE" will return message like "Class not registered". I would like to catch the error return value, and then I could do error processing when error value returns.

Which parameter or variable does store the error return value?...

I guess "EX-APP" handle does it, but what values are they?...
An exception is raised that you should handle in the declarative section. For example:


OBJECT-EXCEPTION-HANDLING SECTION.
          USE AFTER EXCEPTION ON OBJECT.
OBJECT-EXCEPTION-HANDLER.
          CALL "C$EXCEPINFO" USING ERROR-INFO, WS-ERR-SOURCE,
                 WS-ERR-DESCRIPTION.
          IF ERROR-INFO-CODE = 340
              ...