Creating the parallel functions load module

The parallel functions load module is the load module named in the call to the MTF library function tinit(). This single load module contains all of your main task program’s parallel functions. It must not contain any user’s C main() programs. z/OS® XL C itself provides the EDCMTFS module to act as the C main() function in the parallel module. EDCMTFS controls processing of the parallel functions as they are scheduled (by way of tsched() calls) to the subtasks. The source code for the EDCMTFS module is included in Figure 1.

Note: The executable module for parallel function program must be a load module (in a PDS data set), created using the linkage editor (and prelinker if required due to the presence of C++ code or C code compiled with the RENT option). The MTF library functions used to access the parallel functions are not compatible with a program object executable module (in a PDSE data set).

The procedures that you usually use to compile and link-edit a z/OS XL C program must be modified such that the library module CEESTART will be the entry point of the parallel functions load module.

When you link-edit this load module, include the following linkage editor control statements:
INCLUDE SYSLIB(EDCMTFS)
ENTRY   CEESTART

For example, the JCL sequence in Figure 1 uses the standard z/OS XL C cataloged procedure EDCCL to compile and link-edit the C source for the parallel functions and create a parallel functions load module named PLMOD in data set USERPGM.LOAD. This load module contains the module EDCMTFS, and has EDCMTFS as the load module’s entry point.

Figure 1. Sample JCL to compile and link parallel functions
//MTASKPGM   EXEC  EDCCL,
//           INFILE='CBC.SCCNSAM(CCNGMT2)',
//           OUTFILE='USERPGM.LOAD(CCNGMT2),DISP=SHR'
//*
//PFUNC      EXEC EDCCL,
//           INFILE='CBC.SCCNSAM(CCNGMT3)',
//           OUTFILE='USERPGM.LOAD(PLMOD),DISP=SHR'
//LKED.SYSLIN DD
  INCLUDE SYSLIB(EDCMTFS)
  ENTRY CEESTART
/*
Note: First, we have a step that compiles and link-edits the main task program.

The addressing mode is subject to normal consideration as described in the z/OS Language Environment Programming Guide.