Micro Focus with Standard Linkage Calling Convention

This document describes using the COBOL Mapping Editor to extract from a MicroFocus COBOL server with a standard COBOL call interface.

graphics/map-same-microFocus.png


Introduction

Because COBOL servers with a standard call interface always contain a PROCEDURE DIVISION header (see PROCEDURE DIVISION Mapping) with all parameters, the COBOL data items of the interface can be evaluated by the IDL Extractor for COBOL and are already offered by the wizard. In most cases the offered COBOL data items will be correct, but you should always check them manually.

If you have selected an IDL file and opened the COBOL Mapping Editor with an existing COBOL to IDL mapping, continue with Mapping Editor User Interface.

Extracting from a Standard Call Interface

If you are extracting IDL from a COBOL source or extending the IDL file by extracting an additional COBOL source with interface type Micro Focus with standard linkage calling convention, the Extractor Settings dialog appears (see also Step 4: Define the Extraction Settings and Start Extraction).

Make sure the interface type is correct.

graphics/map-same-microFocus_extract.png

Press Next to open the COBOL Mapping Editor.

Start of instruction setTo select the COBOL interface data items of your COBOL server

  1. Add the COBOL data items to COBOL Interface by using the context menu or toolbar available in the COBOL Source View and COBOL Interface. See Notes.

  2. Continue with COBOL to IDL Mapping.

Notes:

  1. If there is a PROCEDURE DIVISION header available, the parameters listed define exactly the COBOL interface. These COBOL data items are within the LINKAGE SECTION and are already selected to the COBOL interface in initial state when you enter the COBOL Mapping Editor. The PROCEDURE DIVISION header might not be available if you are extracting from a copybook or part of the COBOL source.
  2. It is very important to select the right COBOL data items describing the COBOL interface correctly. This means the COBOL data items used as parameters must match in number and in sequence of formats (COBOL usage clause).
  3. If your COBOL interface contains REDEFINEs, the first REDEFINE path is offered by default. Check manually whether this is the one you want. If not, correct it. You can select any other REDEFINE path.

The user interface of the COBOL Mapping Editor is described below.

Mapping Editor User Interface

This section assumes you have set the extraction settings as described above. The following areas of the COBOL Mapping Editor user interface are described here:

For COBOL server programs with standard call interface types, the user interface of the COBOL Mapping Editor looks like this:

graphics/map-same-microFocus_interface-small-1.png COBOL Program Selection. Currently selected program with interface type graphics/toc_closed.png More info
graphics/map-same-microFocus_interface-small-2.png COBOL Source View. Contains all related sources for the currently selected COBOL program graphics/toc_closed.png More info
graphics/map-same-microFocus_interface-small-3.png COBOL to IDL Mapping. Tree view of your selected COBOL data items and mapping buttons with which you can map these items to your IDL interface graphics/toc_closed.png More info

COBOL Program Selection

graphics/map-same-microFocus_interface_prog.png

The COBOL Program Selection displays the current selected COBOL program with its interface type. If you have extracted more than one COBOL program within the associated IDL file, you can switch to another COBOL program with its mapping by selecting the name in the combo box.

COBOL Source View

graphics/map-same-microFocus_interface_source.png

All COBOL data items contained in the LINKAGE and WORKING-STORAGE SECTION are offered in a text view for selection. The text view contains all related sources (including copybooks) for the currently selected COBOL program. It is used for selecting data items and retrieving information from the original COBOL sources. The light green bar indicates that the data item is already contained in the COBOL Interface; a dark green bar indicates the data item is selectable and can be added to the COBOL Interface. This section can be collapsed. If you open the Editor with Modify Interface it is collapsed by default. The toolbar provides the following actions:

graphics/icon_addToInterface.gif Add selected COBOL data item to COBOL Interface.
graphics/icon_removeFromInterface.gif Remove selected COBOL data item from COBOL Interface.
graphics/icon_removeAllFromInterface.gif Remove all COBOL data items from COBOL Interface.
graphics/icon_restoreDefault.gif Reset COBOL Interface to initial state.
graphics/icon_settings.gif Show dialog to modify COBOL Source Characteristics. Not available for interface type COBOL Converter.
graphics/icon_search.gif Show dialog to find text in Source.

The same functionality is also available from the context menu.

COBOL to IDL Mapping

This section covers the following topics:

COBOL Interface

The COBOL Interface shows a tree view of your selected COBOL data items describing the interface of the COBOL server. A context menu is available for the COBOL data items, which provides mapping and other functions. On some COBOL data items, decision icons indicate where particular attention is needed, including mapping icons to visualize the COBOL data type and your current mapping.

The COBOL data item names are derived from the COBOL source from which they were extracted. If your COBOL interface contains parameters without a name (for example, the keyword FILLER is used) those COBOL data items are shown as [FILLER]. See FILLER Pseudo-Parameter.

graphics/map-same-microFocus_interface_cob2idl_cob.png

You can modify the COBOL interface using context menu or toolbar; decision and mapping icons provide additional information.

Context Menu

The context menu on COBOL data items provides the following mapping and other functions, depending on the data item type, the COBOL level and the current mapping.

Map to In | Out | InOut A suppressed COBOL data item becomes visible in the IDL interface. Used also to select another REDEFINE path.
Suppress Suppress unneeded COBOL data items.
Set Constant Set COBOL data items to constant.
Map to Binary Map a COBOL data item as IDL parameter of type binary (Bn, BV) to exchange binary data (for example images). See Map to Binary and Revert Binary Mapping under Mapping Editor IDL Interface Mapping Functions.
Revert Binary Mapping Undo the Map to Binary operation and use the standard mapping.
Remove from COBOL Interface Remove the data item from the COBOL interface. This also removes the mapped IDL parameter from all IDL interfaces for the current COBOL program. See COBOL Program Selection.

See also Mapping Editor IDL Interface Mapping Functions.

Toolbar

The toolbar offers the following actions:

graphics/icon_plus.gif Create IDL Interface. Creates a new IDL interface based on the current COBOL interface: all IDL parameters are of IDL direction InOut; no IDL parameters are set to constant; for COBOL REDEFINE, the first REDEFINE path is mapped to IDL; FILLERs are suppressed according to your selection, see Step 4: Define the Extraction Settings and Start Extraction.
graphics/icon_duplicate.gif Copy current IDL Interface. Creates a duplicate of the current IDL interface: all modifications such as IDL directions, suppress, selection of REDEFINE paths etc. are kept.
graphics/icon_remove.gif Remove current IDL Interface.
graphics/icon_rename.gif Rename current IDL Interface.
graphics/icon_expand.png Expand the full tree.
graphics/icon_collapse.png Collapse the full tree.

See also Map to Multiple IDL Interfaces.

Decision Icons

The decision icons in the first column are set on COBOL data items where particular attention is needed:

graphics/icon_decisionRedefine.png This icon visualizes a COBOL REDEFINE. It is essential that you map the correct redefine path for your mapping to In, Out or InOut using the context menu. If you map a REDEFINE path, all other sibling REDEFINE paths are automatically set to "Suppress".
Mapping Icons

The following mapping icons on the COBOL data items indicate your current IDL mapping:

graphics/icon_in.png Scalar parameter, mapped to In.
graphics/icon_inout.png Scalar parameter, mapped to InOut.
graphics/icon_out.png Scalar parameter, mapped to Out.
graphics/icon_group-inOut.png Group parameter, here mapped to InOut.
graphics/icon_redefine-inOut.png REDEFINE parameter, here mapped to InOut.
graphics/icon_constant.png Parameter set to Constant.

Mapping Buttons

The following buttons are available:

graphics/map-same-microFocus_interface_cob2idl_buttons.png

Map to In | Out | InOut ->

See Map to In, Out, InOut. A suppressed COBOL data item becomes visible in the IDL interface. Used also to select another REDEFINE path.

Suppress

See Suppress Unneeded COBOL Data Items.

Set Constant...

See Set COBOL Data Items to Constants.

IDL Interface

If you have mapped the COBOL interface to multiple IDL interfaces, select the IDL interface by choosing the tabs. In the IDL Interface tree view, a context menu is also available with the following possibilities:

  • Rename the IDL parameter.

  • Remove from COBOL Interface. This also removes the mapped IDL parameter from all IDL interfaces for the current COBOL program. See COBOL Program Selection above.

graphics/map-same-microFocus_interface_cob2idl_idl.png

Mapping Editor IDL Interface Mapping Functions

This section covers the following topics:

Map to In, Out, InOut

With the Map to In, Out, InOut functions you make a COBOL data item visible as an IDL parameter in the IDL interface. With correct IDL directions you design the IDL interface by defining input and output parameters. COBOL programs have no parameter directions, so you need to set IDL directions manually.

Start of instruction setTo provide IDL directions

  • Go step-by-step through all top-level COBOL data items in the COBOL interface and use the Map to In, Out and InOut functions available in the context menu of the COBOL interface and as mapping buttons to make the COBOL data items visible and provide IDL directions in the IDL interface:

    graphics/idlFunctions_provide.png

Notes:

  1. If a top-level COBOL group is mapped, the IDL direction is inherited by all subordinate COBOL data items and thus to the related IDL parameters in the IDL interface.
  2. Subordinate COBOL data items can only be mapped to the same IDL direction as their top-level COBOL group data item.
  3. With the inverse function Suppress Unneeded COBOL Data Items (see below) available in the context menu of the COBOL interface and as mapping button, a COBOL data item can be removed from the IDL interface.
  4. IDL directions are described in the direction-attribute in attribute-list under Software AG IDL Grammar in the IDL Editor documentation.

If you are using an RPC server such as the z/OS (CICS | Batch), z/VSE (CICS | Batch), Micro Focus or BS2000 RPC server, the amount of data to be transferred to/from the RPC client is reduced with correct IDL directions.

Map OCCURS DEPENDING ON

With the Map to In, Out, InOut functions you can make the COBOL ODO subject (here COBOL data item TABLE) of a variable-sized COBOL table (see COBOL Tables with Variable Size - DEPENDING ON Clause) visible as an IDL unbounded group (with maximum). The ODO object (here COBOL data item COUNTER-1) is suppressed and therefore not part of the IDL interface. This is because the number of elements of the IDL unbounded group is already implicitly available. See the following example:

01 COUNTER-1 PIC 99.
01 TABLE OCCURS 1 TO 10 DEPENDING ON COUNTER-1
 02 FIELD1 PIC XX.
 02 FIELD2 PIC 99.

Start of instruction setTo map OCCURS DEPENDING ON

  1. Add the COBOL ODO subject (here data item TABLE) and ODO object (here data item COUNTER-1) to the COBOL interface. It is important both data items are in the COBOL interface.

  2. Use the Map to In, Out and InOut functions available in the context menu of the COBOL interface and as mapping buttons and apply IDL directions for the ODO subject (data item TABLE):

    graphics/idlFunctions_odo-same.png

Notes:

  1. The ODO subject can be mapped to the IDL interface.
  2. The ODO object is always suppressed, but is required to be part of the COBOL interface.
  3. IDL directions are described in the direction-attribute in attribute-list under Software AG IDL Grammar in the IDL Editor documentation.

Map to Multiple IDL Interfaces

Assume the COBOL server program provides multiple functions or operations, in the following example ADD, SUBRACT, MULTIPLY. Some dispatcher front-end code executes the correct function, for example, depending on a function-code or operation-code parameter:

graphics/map-common_idlFunctions_multiple.png

COBOL snippet: The execution of the different functions ADD, SUBTRACT, MULTIPLY is controlled by the COBOL data item OPERATION. The contents of this decide on the function executed:

. . .

     01 OPERATION                      PIC X(1).
     01 OPERAND1                       PIC S9(9) BINARY.
     01 OPERAND2                       PIC S9(9) BINARY.
     01 FUNCTION-RESULT                PIC S9(9) BINARY.
     . . .
     MOVE 0 TO FUNCTION-RESULT.
     EVALUATE OPERATION
         WHEN "+"
            ADD OPERAND1 OPERAND2
            GIVING FUNCTION-RESULT
         WHEN "-"
            SUBTRACT OPERAND2 FROM OPERAND1
            GIVING FUNCTION-RESULT
         WHEN "*"
            MULTIPLY OPERAND1 BY OPERAND2
            GIVING FUNCTION-RESULT
         WHEN . . .

     END-EVALUATE.
. . .

If you have such a situation, a good approach is to expose each COBOL server program function separately as an IDL program. This gives advantages in further processing of the IDL and COBOL mapping files (SVM and CVM). See the following examples, depending on your target endpoint:

  • Integration Server
    Instead of having a single adapter service for the EntireX Adapter generated with the Integration Server Wrapper, you have separate adapter services, one for each COBOL function.

  • Web service
    Instead of having a Web service with a single operation generated with the Web Services Wrapper, you get a web service with multiple operations, one operation for each COBOL function.

  • DCOM, Java or .NET
    Instead having a class with a single method generated with the respective wrapper (DCOM | Java | .NET) you get a class with multiple methods, one method for each COBOL function.

Start of instruction setTo map a COBOL interface to multiple IDL interfaces

  1. Select the tab with COBOL to IDL Mapping. For each function, define a separate IDL interface with the toolbar functions graphics/icon_plus.gif or graphics/icon_duplicate.gif:

    graphics/idlFunctions_multiple-diff-1.png

  2. Give the IDL interfaces meaningful names with the toolbar function graphics/icon_rename.gif:

    graphics/idlFunctions_multiple-diff-2.png

  3. Define the required constant values to the function-code or operation-code parameter, see Set COBOL Data Items to Constants above:

    graphics/idlFunctions_multiple-diff-3.png

For the delivered Example 1: COBOL Server with Multiple Functions:

  • First, for step 1 above: Extract and define 3 separate IDL programs ADD, SUBTRACT, MULTIPLY.

  • Second, for step 2 above: Rename them to suitabable names, e.g. 'ADD', 'SUBTRACT', 'MULTIPLY'.

  • Third, for step 3 above: Define the constants '+', '-' and '*' to the parameter OPERATION respectively.

  • Press Finish to create the following IDL together with a server mapping file. See Server Mapping Files for COBOL.

    library 'EXAMPLE' is
    
     program 'ADD' is
      define data parameter
       1 OPERAND1 (I4) In
       1 OPERAND2 (I4) In
       1 FUNCTION-RESULT (I4) Out
      end-define
    
     program 'SUBTRACT' is
      define data parameter
       1 OPERAND1 (I4) In
       1 OPERAND2 (I4) In
       1 FUNCTION-RESULT (I4) Out
      end-define
    
     program 'MULTIPLY' is
      define data parameter
       1 OPERAND1 (I4) In
       1 OPERAND2 (I4) In
       1 FUNCTION-RESULT (I4) Out
      end-define
    

Notes:

  1. The following functions are offered to create further mappings from the COBOL interface, resulting in multiple IDL interfaces (IDL programs).
    Icon Function Description
    graphics/icon_plus.gif Create IDL Interface Creates a new IDL interface based on the current COBOL interface. All IDL parameters are of IDL direction InOut; no IDL parameters are set to constant; for COBOL REDEFINE, the first REDEFINE path is mapped to IDL; FILLERs are suppressed according to your selection, see Step 4: Define the Extraction Settings and Start Extraction.
    graphics/icon_duplicate.gif Copy current IDL Interface Creates a duplicate of current IDL interface. All modifications such as IDL directions, suppress, selection of REDEFINE paths etc. are kept.
    graphics/icon_rename.gif Rename current IDL Interface The default name for the IDL interface is based on the COBOL program name plus appended number. With this function you can give the IDL interface a suitable name.
    graphics/icon_remove.gif Remove current IDL Interface Deletes the current IDL interface.
  2. With the steps 1 thru 3 described here you can emulate the behavior of function Map to Operation of EntireX version 9.6 and earlier.

Select REDEFINE Paths

For COBOL server programs containing COBOL REDEFINEs, the correct REDEFINE path needs to be chosen for the IDL interface.

Start of instruction setTo select redefine paths

  • Use the Map to In, Out or InOut functions available in the context menu of the COBOL interface and as mapping buttons to make the COBOL REDEFINE path available in the IDL interface.

    graphics/idlFunctions_redefine-same.png

    Begin with the COBOL REDEFINE defined at the highest level first. Work through all inner COBOL REDEFINE data items, going from higher levels to lower levels.

Notes:

  1. Only one REDEFINE path of a COBOL REDEFINE can be mapped to the IDL interface. All COBOL REDEFINE siblings are suppressed.
  2. If a REDEFINE path is actively mapped to the IDL interface, all COBOL REDEFINE siblings are suppressed.
  3. You can suppress all REDEFINE paths of a COBOL REDEFINE. Simply suppress the active REDEFINE path, see Suppress Unneeded COBOL Data Items above.

Suppress Unneeded COBOL Data Items

COBOL data items without any relevant information can be made invisible in the IDL interface. The IDL interface is simplified - it becomes shorter and tidier. This is useful, for example

  • for FILLER data items

  • if the consuming RPC client or IS service does not need an Out parameter

  • if the COBOL data item is an In parameter and a low value can be provided

If you are using an RPC server such as the z/OS (CICS | Batch), z/VSE (CICS | Batch), Micro Focus or BS2000 RPC server, the amount of data to be transferred to/from the RPC client is also reduced.

Start of instruction setTo suppress unneeded COBOL data items

  • Use the Suppress function available in the context menu of the COBOL interface and as mapping button to make the COBOL data item invisible in the IDL interface:

    graphics/idlFunctions_suppress-same.png

Notes:

  1. The COBOL data item is not part of the IDL interface. It is invisible for consuming RPC clients or IS services.
  2. The RPC server or EntireX Adapter provides the COBOL data item to your COBOL server with low value, managing the offset to the next COBOL data item.
  3. If a COBOL group is suppressed, all subordinate COBOL data items are suppressed as well.
  4. With the inverse functions Map to In, Out or InOut (see above) available in the context menu of the COBOL interface and as mapping buttons, a COBOL data item is made visible in the IDL interface again.

Set COBOL Data Items to Constants

COBOL data items that always require fixed constant values on input to the COBOL interface can be made invisible in the IDL interface and initialized with the required constant values. This is useful for keeping the IDL interface short and tidy. Consuming RPC clients or IS services are not bothered with IDL parameters that always contain constants, such as RECORD-TYPES. This function is often used in conjunction with Map to Multiple IDL Interfaces (see above).

Start of instruction setTo set COBOL data items to constants

  1. Use the Set Constant function available in the context menu of the COBOL interface and as mapping button to define a constant value for a COBOL data item:

    graphics/idlFunctions_constant-1-same.png

  2. You are prompted with a window to enter the constant value:

    graphics/idlFunctions_constant-2.png

Notes:

  1. The COBOL data item is not part of the IDL interface. It is invisible for consuming RPC clients or IS services.
  2. The RPC server or EntireX Adapter provides the defined constant in the COBOL data item to your COBOL server.
  3. With the functions Map to In, Out, InOut (see above) available in the context menu of the COBOL interface and as mapping buttons, a COBOL data item can be made visible in the IDL interface again.

Map to Binary and Revert Binary Mapping

With such a mapping you allow the COBOL server to deal with binary data (for example images).

graphics/idlFunctions_map2bin-1.png

The menu entry Map to Binary appears only on COBOL data items were it makes sense, for example in Channel Container interface types it is not allowed to map the container reference itself as binary, but inner items can be mapped as binary. Redefine groups will be handled as a block, that means the largest redefine path or redefine base defines the binary length.

When the binary IDL parameter is selected, all corresponding COBOL data items are selected as well.

graphics/idlFunctions_map2bin-2.png

To undo the binary mapping, select the root COBOL data item (the first of the selection group) and from the context menu choose Revert Binary Mapping.

graphics/idlFunctions_map2bin-3.png