Note
Targets of the main program (.EXE) and the library of business logic (.DLL) are created at the time of building on the CORBA server application.
The main program is created from the COBOL source that is set as a main program in the "Dependence" view, and other COBOL sources are all linked with library of business logic.
The repository file and library file used for UNICODE are provided in the Interstage Application Server. For details about developing a UNICODE application , refer to "NetCOBOL Users' Guide" and "Interstage Application Server Application Creation Guide (CORBA service)"
By specifying "Using Unicode" in the CORBA server project generation wizard, a build can be executed using the file used for UNICODE.
Use the CORBA server project generation wizard to create the CORBA server project for CORBA server application.
Create a server application template and a template of the IDL file (interface definition file) required for creating a CORBA server project.
Note
Of the types of CORBA server applications, only applications with CORBA server as the target can be created.
The applications are actually created as exe and dll files.
Creating a project
Create a CORBA server project by following the procedure below.
Starting the Interstage Studio workbench.
Select "File" > "New" > "CORBA Server Project" from the menu bar. The "New CORBA Server Project" wizard is started.
Specify information in the "New CORBA Server Project" wizard as follows:
On the "CORBA Server Project" page, specify Basic Project Information.
On the "CORBA Server Project" page, define a target.
If the target definitions specify a project that uses a precompiler, then specify precompiler linkage information.
On the "Build Environment" page, define the build environment for the CORBA server.
On the "Select" page, select "Generate code".
Click the "Finish" button.
Option | Description | |
---|---|---|
Target type | Specifies the target type of the COBOL application to be created. "CORBA server" is selected. | |
CORBA server |
For the other information of target, refer to "Table 4.3 Defining the target".
Option | Description |
---|---|
Using Unicode | Selected (checked) when Unicode is used. |
Create templates of an IDL file and a COBOL source file using the CORBA server application wizard.
Template file | Description | Creating file name | |
---|---|---|---|
IDL file(*1) | Interface definition language file | USinterface-name.idl | |
COBOL source file | Main program source | CORBA server initial and termination processing | interface-name.cob |
Business method program source | Business method definitions | module-name-interface-IMPL.cob | |
Server application registration program source | Server application registration | module-name-interface--INIT.cob | |
Skeleton File generated with IDL compiler | module-name-COBO-source-file |
*1: Interface Definition Language (IDL):
Format of the IDL file to be created
One module can be defined for one project. Defining a class for business methods within the module generates an IDL file interface declaration. For details on the IDL file, refer to the "Interstage Application Server Distributed Application Development Guide (CORBA Service Edition)". This section describes the format of the IDL file to be created and the declarations generated by the IDL file.
// Module declaration module M1 { // Interface declaration interface intf1 { // Constant declaration const long a = 1 ; // Type declaration typedef sequence<long 10> b ; // Structure declaration struct c { short item1 ; long item2 ; long long item3 ; } ; // Exception declaration exception CDException { string CDExceptionMsg ; long CDExceptionCode ; } ; // Operator declaration long op1(in short param1, out long param2, inout long param3) raises ( CDException ); }; };
definition | Explanation |
---|---|
Module declaration | Declaration for a server application. One module is defined for one application. |
Interface declaration | Declaration for a class. The class is for business method definition. |
Constant declaration | Declaration of a constant used in a business method |
Type declaration | Declaration of a type used in a business method. This declaration is used to define iteration items. |
Structure declaration | Declaration of a structure. For object-oriented COBOL, this corresponds to a definition of group items. The CORBA server application wizard does not allow a structure to be defined as a structure element type. |
Exception declaration | Declaration of the contents of a record that is posted if an exception is thrown. The processing of actual exception notification must be coded within the program. exception CDException { string CDExceptionMsg ; long CDExceptionCode ; } ; |
Operator declaration | Generates one operator per business method declaration. If an exception declaration is selected as an option, a definition is generated for returning the declared record in the exception declaration in the event that an exception is thrown. |
After the model has been created, editing of the IDL file and the COBOL source file can be performed freely. However, it is necessary to synchronize the contents of the IDL file with the COBOL source file.
For example, it is necessary to modify both the IDL file and the COBOL source file when changing the predefined method definition.
When changing the contents of the interface, modify it to be equivalent to the business method program.
In order to maintain the selected standard application format, modify only when it is necessary.
Execute the procedures of each method.
For details about the adding process, refer to "Interstage Application Server Application Creation Guide (CORBA service)".
The server application performs the registration in order to use it as a CORBA server. Use it without modification.
Use it without modification.
The CORBA server application generation wizard generates an interface definition file (IDL file) and a sample CORBA server application.
Start the CORBA Server Application Skeleton Code wizard by following the procedure below.
Select "File" > "New" > "Other" from the menu bar. The "New" wizard starts.
Select "COBOL" > "Source" > "CORBA Server Application" in the "New" wizard, and click the "Next" button. The "CORBA Server Application generation" wizard starts.
Specify information in "New CORBA Server Application Skeleton Code" as follows:
On the "Module Declaration" page, specify information including a module name and exception declaration.
On the "Constant Declaration" page, specify information on the literals required for an interface declaration.
On the "Type Declaration" page, specify the type information required for an interface declaration.
On the "Structure Declaration" page, specify information on the structure used for an interface declaration.
On the "Method Declaration" page, specify information on the method used for an interface declaration.
Option | Description |
---|---|
Project name | Specifies the project in which the generated CORBA server application source is to be stored. A project name must be specified. |
Module name | Specifies the module name for the generated CORBA server application source. A module name must be specified. |
Class name | Displays the class name for the generated CORBA server application. The class name is the same as the project name. A class name is generated as an interface name in the IDL file after the wizard is completed. |
Generate exceptions | Specifies whether to make the default exception declaration in the generated CORBA server application. exception CDException { |
Generate default code | Specifies whether to generate the default process for the generated CORBA server application. |
Generate comments | Specifies whether to generate a comment in the generated CORBA server application. |
Use precompiler | When the pre-compiler link information is set to the project of "Project name", this item is enabled. When checked, the extension of the COBOL source file becomes an extension set to the precompiler link information. For the precompiler link information, see "Table 4.4 Precompiler link information ". |
Note
For IDL compilation during source generation, the Interstage service must be started in advance. If the wizard displays the message "The environment which compiles IDL is not prepare." on the "Module Declaration" page during source generation, click "Cancel" to quit the wizard. Start the Interstage service before restarting the source generation wizard.
Option | Description |
---|---|
Type | Used to select the type of literal to be declared. |
Constant Name | Specifies the name of the literal being defined. |
Initial Value | Specifies the default value of a literal. |
Add | Adds a new constant declaration. |
Delete | Deletes the selected constant declaration. |
Type that can be defined | COBOL | IDL |
---|---|---|
2-byte integer | PIC S9(4) COMP-5 | short |
2-byte integer (unsigned) | PIC 9(4) COMP-5 | unsigned short |
4-byte integer | PIC S9(9) COMP-5 | long |
4-byte integer (unsigned) | PIC 9(9) COMP-5 | unsigned long |
Single precision floating-point number | COMP-1 | float |
Double precision floating-point number | COMP-2 | double |
Alphanumeric character | PIC X(1) | char |
Boolean | PIC 1(1) | boolean |
Alphanumeric character string | PIC X(n) | string |
Character literal | Character enclosed by single quotation marks (e.g., 'A') |
String literal | Character string enclosed by double quotation marks (e.g., "ABC") |
4-byte integer | Numeric value (e.g., 1) |
Logical value | TRUE or FALSE |
Option | Description |
---|---|
Type | Used to select the type of variable name to be declared. |
Variable Name | Specifies the name of the variable being defined. |
No. of Digits/Characters | Specifies the total number of columns when the type is alphanumeric character string, national character string, or packed-decimal number. |
Scale | Specifies the number of decimal places when the type is packed-decimal number. |
No. of Repitions | Specifies the repetition count of a one-dimensional element. |
Add | Adds a new type declaration. |
Delete | Deletes the selected type declaration. |
Type that can be defined | COBOL | IDL |
---|---|---|
2-byte integer | PIC S9(4) COMP-5 | short |
2-byte integer (unsigned) | PIC 9(4) COMP-5 | unsigned short |
4-byte integer | PIC S9(9) COMP-5 | long |
4-byte integer (unsigned) | PIC 9(9) COMP-5 | unsigned long |
8-byte integer | PIC S9(18) COMP-5 | long long |
Packed-decimal number | PIC xx(n) PACKED-DECIMAL (*) | fixed |
Single precision floating-point number | COMP-1 | float |
Double precision floating-point number | COMP-2 | double |
Alphanumeric character | PIC X(1) | char |
National character | PIC N(1) | wchar |
Boolean | PIC 1(1) | boolean |
Alphanumeric character string | PIC X(n) | string |
National character string | PIC N(n) | wstring |
*1: The COBOL type of a packed-decimal number depends on the combination of the total number of columns and the number of decimal places. For details, refer to "COBOL Programming Guide" in the "Interstage Application Server Distributed Application Development Guide (CORBA Service Edition)".
Option | Description |
---|---|
Structures | Lists defined structures. |
Add | Adds a new structure. |
Edit | Modifies definition information on the selected structure. |
Delete | Deletes the selected structure. |
Option | Description |
---|---|
Structure name | Specifies the name of the structure being defined. |
Variable Name | Specifies the name of the variable being defined. |
Type | Used to select the type of variable name to be declared. |
No. of Digits/Characters | Specifies the total number of columns when the type is alphanumeric character string, national character string, or packed-decimal number. |
Scale | Specifies the number of decimal places when the type is packed-decimal number. |
Sequence Size | Specifies the repetition count of a one-dimensional element. |
Add | Adds a new element to the structure. |
Delete | Deletes the specified structure element. |
Type that can be defined | COBOL | IDL |
---|---|---|
2-byte integer | PIC S9(4) COMP-5 | short |
2-byte integer (unsigned) | PIC 9(4) COMP-5 | unsigned short |
4-byte integer | PIC S9(9) COMP-5 | long |
4-byte integer (unsigned) | PIC 9(9) COMP-5 | unsigned long |
8-byte integer | PIC S9(18) COMP-5 | long long |
Packed-decimal number | PIC xx(n) PACKED-DECIMAL (*1) | fixed |
Single precision floating-point number | COMP-1 | float |
Double precision floating-point number | COMP-2 | double |
Alphanumeric character | PIC X(1) | char |
National character | PIC N(1) | wchar |
Boolean | PIC 1(1) | boolean |
Alphanumeric character string | PIC X(n) | string |
National character string | PIC N(n) | wstring |
Any type (*2) | Any type | Any type |
*1: The COBOL type of a packed-decimal number depends on the combination of the total number of columns and the number of decimal places. For details, refer to "COBOL Programming Guide" in the "Interstage Application Server Distributed Application Development Guide (CORBA Service Edition)".
*2: Enter the type specified in a type definition (type of repetition item). "Any type" must be one that is defined in a type definition.
Option | Description |
---|---|
User methods | Lists defined user methods. |
Details | Displays detailed information on the user method selected from "User Method Definition". |
Add | Adds a new user method (business method). |
Edit | Modifies definition information on the method selected from "User Method Definition". |
Delete | Deletes the user method (business method) selected from "User Method Definition". |
Option | Description |
---|---|
Method name | Specifies the name of the user method being defined. |
Return type | Used to select the type of method return value. |
No. of Digits/Characters | Specifies the total number of columns for the return value. |
Scale | Specifies the number of decimal places for the type of the return value. |
Throws an exception | Specifies whether to generate a process that reports multiplication and division exceptions in the generated CORBA server application. |
Parameters | Can be used to add and delete parameters. The variable and type of each parameter can be edited. A parameter type can be selected from the list of types or specified directly. The character string specified for a variable name cannot consist of a mixture of en-size and em-size characters. No em-size character can be used to specify the type. |
Variable Name | Specifies the name of the variable being defined. |
Type | Used to select the type of variable name to be declared. |
No. of Digits/Characters | Specifies the total number of columns when the type is alphanumeric character string, national character string, or packed-decimal number. |
Scale | Specifies the number of decimal places when the type is packed-decimal number. |
Parameter Type | Used to select the parameter type. |
Add | Adds a new parameter to the user method. |
Delete | Deletes the selected user method parameter. |
Type that can be defined | COBOL | IDL |
---|---|---|
None | - | oneway void |
2-byte integer | PIC S9(4) COMP-5 | short |
2-byte integer (unsigned) | PIC 9(4) COMP-5 | unsigned short |
4-byte integer | PIC S9(9) COMP-5 | long |
4-byte integer (unsigned) | PIC 9(9) COMP-5 | unsigned long |
8-byte integer | PIC S9(18) COMP-5 | long long |
Packed-decimal number | PIC xx(n) PACKED-DECIMAL )*1) | fixed |
Single precision floating-point number | COMP-1 | float |
Double precision floating-point number | COMP-2 | double |
Alphanumeric character | PIC X(1) | char |
National character | PIC N(1) | wchar |
Boolean | PIC 1(1) | boolean |
Alphanumeric character string | PIC X(n) | string |
National character string | PIC N(n) | wstring |
Any type (*2) | Entered type | Entered type |
*1: The COBOL type of a packed-decimal number depends on the combination of the total number of columns and the number of decimal places. For details, refer to "COBOL Programming Guide" in the "Interstage Application Server Distributed Application Development Guide (CORBA Service Edition)".
*2: Enter the type specified in a type definition or structure definition.
Type that can be defined | COBOL | IDL |
---|---|---|
2-byte integer | PIC S9(4) COMP-5 | short |
2-byte integer (unsigned) | PIC 9(4) COMP-5 | unsigned short |
4-byte integer | PIC S9(9) COMP-5 | long |
4-byte integer (unsigned) | PIC 9(9) COMP-5 | unsigned long |
8-byte integer | PIC S9(18) COMP-5 | long long |
Packed-decimal number | PIC xx(n) PACKED-DECIMAL (*1) | fixed |
Single precision floating-point number | COMP-1 | float |
Double precision floating-point number | COMP-2 | double |
Alphanumeric character | PIC X(1) | char |
National character | PIC N(1) | wchar |
Boolean | PIC 1(1) | boolean |
Alphanumeric character string | PIC X(n) | string |
National character string | PIC N(n) | wstring |
Any type (*2) | Entered type | Entered type |
*1: The COBOL type of a packed-decimal number depends on the combination of the total number of columns and the number of decimal places. For details, refer to "COBOL Programming Guide" in the "Interstage Application Server Distributed Application Development Guide (CORBA Service Edition)".
*2: Enter the type specified in a type definition or structure definition.
The CORBA Server Application wizard creates the template using the BOA interface. For the details of BOA interface, refer to "interstage Application Server application guide (CORBA Service)".
A client interface (IDL) file that describes a structure can be created based on CORBA/IDL object-oriented COBOL mapping.
Start the IDL File wizard by following the procedure below.
Select "File" > "New" > "Other" from the menu bar. The "New" wizard is started.
Select "COBOL" > "Source" > "IDL File" in the "New" wizard. The "IDL File" wizard is started.
Specify basic information for the IDL file on the "IDL File Information" page.
Option | Description |
---|---|
Project name | Specifies the project in which the IDL file is generated. |
File name | Specifies a file name. |
Click the "Finish" button. The IDL file is created.
Build includes the following types of processing executed in the order listed:
Generating stub and skeleton files through IDL file compilation
Compiling stub and skeleton files
Compiling the program source
Linking
Option set automatically
When a CORBA server project is created, the options listed below are automatically set as build options.
Unicode is not used
LIB(Interstage Application Server installation folder\odwin\include\oocob) REPIN(Interstage Application Server installation folder\odwin\rep THREAD(MULTI)
Unicode is used
LIB(Interstage Application Server installation folder\odwin\include\oocob) REPIN(Interstage Application Server installation folder\odwin\rep\Unicode) THREAD(MULTI) RCS(UTF16,LE)
The following libraries are linked:
Unicode is not used
Interstage Application Server installation folder\odwin\lib\odoocobsv.lib Interstage Application Server installation folder\odwin\lib\odcnsoocob.lib
Unicode is used
Interstage Application Server installation folder\odwin\lib\odoocobsvuc.lib Interstage Application Server installation folder\odwin\lib\odcnsoocobuc.lib
To set other options, select "Build" from "Properties" of project, and specify the options.
The "Build" page is displayed as follows:
Select the CORBA server project in "Dependency" view or "Structure" view.
Select "File" > "Property" from the menu bar or select the "Property" from the context menu. The "Properties" dialog box appears.
Select "Build " from the left pane. The "Build" page appears.
Project Build
Select "Save" from the context menu of the edit window in the source program and the CORBA server application is built automatically. However, if "Project" > "Build Automatically" was not previously selected (the "Build Automatically" menu item will have a check if it was selected), the application is not built. In this case, select the project in the "Dependency" view or the "Structure" view, and select "project" > "project build" to build the project.
The IDL compiler compiles the IDL file during building. The skeleton and other files required for server applications are generated and added as compilation targets.
Configuring Build Tool
When the CORBA server project is developed, it registers the following in the build tool.
IDL compiler
COBOL compiler
linker
In the steps below, the "Build tool" page is displayed and sets the build tool configuration.
Select the CORBA server project in the "Dependency" view or the "Structure" view.
Select the "Properties" option from the context menu or select "File" > "Properties" from the menu bar. The "Properties" dialog box appears.
Select "Build Tools" from the left pane. A list of build tools associated with the application is displayed. Build executes the build tools in the displayed sequence.
Option | Description |
---|---|
Add from Application | Add build tool from the application type. |
Add Build Tool | Add a build tool to the project. |
Remove | Removes the selected build tool. |
Up | Changes the execution sequence of the selected build tool. |
Down | Changes the execution sequence of the selected build tool. |
Restore Defaults | Restores the build tool configuration to that at the project creation time. |
Apply | Changed contents are applied. |
Note
The build tool to be added should have the following prerequisites
The build tool related to the specified build tool should be available.
Corresponding to the specified build tool, the specified execution sequence should be correct.
When you want to add a build tool or change the executing order of the build tool, be careful about the execution sequence and then make the settings.
The following build tool is executed before the COBOL compiler.
IDL Compiler
Precompiler
The following build tools are executed after the COBOL compiler.
Resource Compiler
Linker
Point
To make detailed settings for added build tools such as the IDL compiler and resource compiler, click "Apply".
IDL Compiler
You can use the IDL compiler to generate source codes from the IDL definition file. The generated source codes are client stubs and object skeletons. The client stubs are used to develop client program. The object skeletons are used to implement CORBA objects.
Select "Build Tool" > "IDL Compiler" from the left pane of the "property" dialog box. The "IDL Compiler" page displays.
Option | Description |
---|---|
Include file folders | Specify folder name that is used for searching files specified in "#include" statement in IDL file. |
Other options | Specify any additional compiler options. When specifying multiple options, delimit them with a space. |
Register to interface repository | Specify this option when you want to register information to the interface repository. |
The program debugging is performed after creating client applications.
On Interstage Application Server, which is installed in the same terminal, use CORBA work unit starting-organization and debug the server application. The debugging of the CORBA server application is the same as attach debugging.
See
For details about debug perspective, refer to "7.2 Debug Perspective".
To debug the program, select "Debug" in "Build mode".
Select the CORBA server project in the "Dependency" view or the "Structure" view, and select "File" >"Property" from the menu bar or select the "Property" from the context menu. The "Property" dialog box displays.
Select "Target" from the left pane. The "Target" page appears.
Specify "Debug" in "Build mode".
If the build mode is changed, the project must be rebuilt.
Select a CORBA server project from the "Dependency" view or the "Structure" view.
Select "Run" > "Debug" from the menu bar, or click of on the toolbar. The "Debug" dialog box is displayed.
Select and double-click "CORBA WorkUnit" in the left pane.
The launch configuration setting page is displayed in the right pane.
The default launch configuration name is displayed at "Name". You can change it to any name you want.
Specify settings on the "Main" tab as follows:
Enter a CORBA WorkUnit name in "CORBA WorkUnit name".
Alternatively, you can select one from the list of CORBA WorkUnits created by Interstage Application Server.
To automatically deploy resources to Interstage Application Server, check "Deploy before launching".
Enter the CORBA server project name in "Project to be deployed", or click "Browse" and select the CORBA server project.
Click "Debug" to start debugging.
To quit debugging, select "Terminate" in the Debug view to stop the CORBA WorkUnit.
Select a CORBA server project from the Dependency view or the Structure view, and select "Run" > "Debug" > "CORBA WorkUnit" from the menu bar. This starts debugging under the default settings.
Note
If services that are required for management of Interstage (Interstage management services) have not started, the list of CORBA WorkUnits in "CORBA WorkUnit name" will not be displayed correctly. In cases such as this, do not create the CORBA WorkUnit launch configuration until after the Management Services have started.
For starting the Interstage management service, refer to "Checking the environment settings of Interstage Application Server"
If services that are required for connection to the local Interstage Application Server are stopped by any debugging that uses the CORBA WorkUnit launch configuration, start those services. In an OS that has a User Account Control (UAC) function, when the service starts, a dialog box will appear telling you that you need administrator permissions. In such a case, change your permissions according to the information displayed.
Information
Settings in the .deployment file
CORBA WorkUnits can automatically deploy resources before debugging. They use the information provided in .deployment files to implement resource deployment. The .deployment file information items are as follows.
Tag | Description |
---|---|
implementation-repository-id | Specifies an implementation repository ID. |
interface-repository-id | Specifies an interface repository ID. |
binding-name | Specifies a naming service registration name. |
workunit-name | Specifies a CORBA WorkUnit name. |
A .deployment file is created based on the module name and interface name specified in the wizard when the CORBA Server Application wizard is executed.
The methods for creating a CORBA work unit (work unit of CORBA application) are as follows.
using Interstage management console
using the work unit generation command (isaddwudef) according to the CORBA work unit definition file
For details about the CORBA work unit creation method from the Interstage management console, refer to "Interstage Application Server Operation Guide (basic)". This section explains the methods of creating a CORBA work unit (MyCORBADebug) using the work unit generation command according to the CORBA work unit definition file for local debugger and command.
Execution of work unit generation command (isaddwudef)
To use the CORBA work unit definition file as an argument, execute the following commands in a command prompt.
isaddwudef NetCOBOL install folder\Samples\CORBA\MyCORBADebug.wu
When using spaces in the CORBA work unit definition file name, enclose the file name in double quote characters. For details about the isaddwudef command, refer to "Interstage Application Server Reference Manual (commands)"
Note
Information such as the work folder is set in the "Path", "Current Directory" property of the CORBA work unit definition file. Generally, although the value is set from the information from the Interstage installed destination folder, correct the setting when errors exist in the path
Settings for environment variables PATH and CLASSPATH are necessary on creation of the CORBA work unit. When errors happen that involve these environment variables, set environment variables PATH and CLASSPATH, and restart your computer.
Use the following procedure to execute the CORBA server application .
Copy the execution resource (execution file and dynamic link library) into the execution environment.
Create the application operation current directory for the start of work unit.
Deploy the CORBA server application.
Start the work unit.
Execute the client application.
For detailed procedures, refer to "5. Running the Program" in the tutorial.