Using the EXIT function

The EXIT function calls a user-written program to return data that is mapped to an item.

The EXIT function is documented in your Functions and Expressions documentation. However there are special considerations when using this function with the z/OS Batch Command Server.

A user exit is invoked by calling the EXIT function in a mapping rule. The EXIT function expects three arguments:


EXIT ("DLL_load_module_or_non_null", 
"DLL_function_or_load_module", "parameters")

If the user exit program is a DLL, the first argument must contain the name of the DLL load module and the second argument must contain the name of the function within the DLL.

If the user exit program is not a DLL, the first argument must contain some value that is not a null string ("")-for example, one or more spaces-and the second argument must contain the name of the load module.

The third argument is a text item that contains parameter information passed to the exit program.

Your user exit programs must reside in one of the load libraries referenced by the STEPLIB DDNAME in the JCL used to run the z/OS Batch Command Server. Any static data areas declared within an exit program, such as COBOL working-storage or C static variables, persist across multiple calls to the exit.

For non-C language (for example, COBOL) exits, four arguments are passed that contain the address of:

  • A full word that contains the length of the parameter text item
  • A space-padded 64K buffer that contains the parameter text item
  • A full word that will contain the length of the resulting text item
  • A 64K buffer where the resulting text item will be placed

For C language exits, a single argument is passed, which is the address of the EXITPARAM structure as described in the Functions and Expressions documentation.

User exits must support the conventions of z/OS Batch standard linkage and be link-edited in 31-bit addressing mode. DLL exits must be compiled as DLL code.

For an example of a C language and COBOL user exit program, see DTXEXRME in the DTX.SDTXSAMP PDS included in the IBM Transformation Extender with Command Server installation.