Inserting IMS code snippets

The workbench Snippets view is customized to assist you as you edit COBOL files and contains categories for IMS snippets.

Supported Editors:
  • COBOL Editor
  • z Systems® LPEX Editor

IMS Snippets are included in the Snippets view only if the installable feature IMS Code Generators is installed in the product. The Snippets view is included by default in the z/OS Projects perspective.

If your snippet begins with a new line of code, begin your snippet with a blank line. This action ensures that the inserted code begins at the correct column position.

The categories for IMS snippets are as follows:

  • IMS Transaction Management for COBOL
  • IMS Database Management for COBOL
  • IMS DB System Services for COBOL
  • IMS TM System Services for COBOL
  • IMS Application Interface Masks for COBOL
  • IMS DL/I Function Codes for COBOL

Management and services categories

You can use the first four snippets categories to add IMS DL/I calls to your COBOL program. Each snippet in these categories corresponds to an individual DL/I function. Requesting one of these snippets opens a window that prompts you for details of the specific DL/I function call. At the top of the window, you specify the interface type to use in the DL/I call from the list of interfaces compatible with the selected DL/I function call. The remaining fields correspond to the parameters of the corresponding DL/I call, with the following exceptions:

  • When you use the language-independent interface (CEETDLI), you might need to complete the Type of Control Block field to specify whether you are using an AIB parameter.
  • The CIMS, DPSB, GMSG, and INQY snippets have a field for you to enter in the subfunction code.

When you use these snippets, references to nested fields of the AIB or PCB control blocks in the snippet code are replaced automatically with the actual fields present in the referenced AIB or control block. For example, when you generate the line of code MOVE LENGTH OF AIB TO AIBRLEN OF AIB, the snippet generator looks up the field that is defined at offset 8 of the AIB control block that is selected in the window and uses that as the name for the AIBRLEN field. If the AIB block cannot be parsed out of the code, a default value for the field is used.

When you generate the DL/I call, the snippet code generator tries to look up a level 77 field whose VALUE clause equals the DL/I function and use that in the call. For example, when you create the code for the GHN snippet, the generator parses the code and might find the following declaration:

77  GET-HOLD-NEXT    PICTURE X(4)  VALUE 'GHN '.

At that point, GET-HOLD-NEXT is substituted into the function call. If no match is found, the snippet name (GHN in this case) is used in the function call.

IMS Application Interface Masks for COBOL

These snippets add commonly used COBOL data structures to your program.

IMS DL/I Function Codes for COBOL

These snippets add the DL/I function names as level 77 data structures.