Importing from COBOL copybooks

Before you start:

To complete this task, you must have completed the following tasks:

Also, before you begin this task, you should note the points listed below:

If you previously used the WebSphere MQ Integrator Version 2.1 COBOL importer to create a message model, you may find that the WebSphere Business Integration Message Broker Version 5.0 importer does not produce exactly the same results. In particular, the Version 2.1 COBOL importer did not support as many COBOL constructs as Version 5.0, and the naming convention for Version 2.1 compound types is not the same as the naming convention for Version 5.0 complex types and groups. In a very few cases, the naming convention for Version 2.1 elements is not the same as the naming convention for Version 5.0 elements. If you created message flow ESQL in Version 2.1 to manipulate your COBOL-derived message model, and you have imported that ESQL into Version 5.0 using the mqsimigratemsgflows command, and you are now recreating your message model using the Version 5.0 COBOL importer, you are strongly recommended to review your ESQL for correctness.

The steps below cover creating a completely new message definition file and overwriting the contents of an existing file.

To create a message definition file from a COBOL data structure:

  1. Switch to the Broker Application Development perspective.
  2. Open the New Message Definition File wizard by clicking File > New > Message Definition File from the workbench menu.
  3. In the displayed list of options, click COBOL file then click Next.
  4. In the displayed list of workbench files, click the COBOL file that you want to import then click Next to display a list of message sets. The file must already be in the workbench for it to appear in the list.
  5. Under Message sets, click the target message set for the message definition file that you are creating. The Message definition file name field is automatically filled in with a default file name, based on the name of the file that you are importing. If required, you can change the displayed default file name to a new name of your choice.
  6. If you want to replace the contents of an existing message definition file:
    1. Type the name of the existing file in the Message definition file name field.
    2. Select the Overwrite the existing file contents without warning check box. The existing file is overwritten without a warning being displayed.
  7. Click Next.
  8. Under Source structures, select the source structures that you want to import then add your selections to Imported structures. Use the >, <, >> and << buttons to select individual or all structures and add them to or delete them from Imported structures.
  9. Under Imported structures, select those data structures that you want to be messages in the message definition file. Either click Select All or click the data structures individually.
  10. Optional: Type a name prefix to be added to all the imported global complex types and groups created during the import. Adding a prefix helps to avoid the possible duplication of names.
  11. Optional: If you do not want to add any further information at this point, click Finish. Your new message definition file is created immediately.
  12. If you want to include further import options, click Next.
  13. On the Import options page, specify the physical properties of the new message definition by selecting the appropriate import options.
  14. Optional: If you want to create default values from the initial values, select the Create default values from INITIAL VALUES check box.
  15. Optional: If you want to create minimum inclusive facets, maximum inclusive facets and enumeration facets from the imported COBOL Level 88 values on the simple type associated with the Schema xsd:element, select the Create facets from level 88 value clauses where possible check box. This adds a Value Constraints node under Logical properties in the Properties Hierarchy and the values that you specify are subsequently used for validation during runtime.
    Note: In cases where a simple type has both minimum and maximum inclusive facets set as well as enumeration facets, the enumeration facets are used in preference to the minimum and maximum inclusive facets.
  16. Optional: If your COBOL level 01 data structure is being initialized to a particular character (for example, SPACE, LOW-VALUE, or HIGH_VALUE) in your COBOL application, consider checking the Create null values for all fields check box. When the data structure is initialized in this way, the resultant message can give rise to parsing errors because certain fields contain a value that is not valid for the data type of the field. Checking the box enables you to treat any fields that have been initialized in this manner as NULL values, thereby enabling parsing to succeed. You specify the initialization character using the Null character control, the default value for which is the SPACE character. Setting these controls results in all xsd:elements having their Nillableproperty set, their Custom Wire Format Encoding Null property set to NullLiteralFill, and their Custom Wire Format Encoding Null Value property set to the specified character. For more information, refer to Custom wire format - NULL handling.
    Set the Null character in one of the following ways:
    • Select SPACE (the default), NUL, 0x00 or 0xFF from the drop-down list.
    • Enter a character between quotation marks, for example "c" or 'c', where c is any alphanumeric character.
    • Enter a hexadecimal character code in the form 0xYY where YY is a hexadecimal value.
    • Enter a decimal character code in the form YY where YY is a decimal value.
    • Enter a Unicode value in the form U+xxxx where xxxx is a Unicode value specified in hexadecimal
    Note: Under normal collation sequence rules, use 0x00 for low-values and 0xFF for high-values.
  17. Click Finish. The message definition file is created from the COBOL file and is opened in the Message Definition editor so that you can check the imported information and make any required changes.
Related concepts
Ways to create message definitions
Import from other model representations to create message definitions
Related tasks
Working with a message set project
Related reference
Import formats
Importing from COBOL: supported features
Physical properties for message model objects
Message model object properties