A C/C++ program unit generally also contains a data structure for the standard primary working area. If the standard primary working area is used by the program unit, then it should include the KDCS parameter area (kcpa.h header file). You should also store the KDCS message areas and other variable data in the standard primary working area.
If you do not store variable data in the standard primary working area, then you must make sure that the program unit is reentrant by storing it in the automatic area of the function, for example.
You must define the KDCS message areas yourself. For calls that request information from openUTM (KDCS_INFOSI, KDCS_INITPU, for example) there are specific data structures provided in the header files. If you are working with a formatting system, you can use automatically generated address assistants to format the KDCS message area (see the formatting system manual).
In the following example, the communication area also contains a KB program area for transferring data to follow-up program units. The message area is located in the SPAB.
#include <kcmac.h> /* UTM data structures */ #include <forma3a.h> /* Structure of the addressing */ /* assistant for +format forma3 */ struct ca_area { struct ca_hdr ca_head; /* KB header */ struct ca_rti ca_return; /* KB return area */ struct ca_prog_area { char ca_info[22]; /* Application-specific */ char ca_start[2]; /* declaration of the KB */ char ca_dest[2]; /* program area */ char ca_fl_day[5]; char ca_fl_nr1[5]; char ca_fl_nr2[5]; } ca_prg; }; struct work { union kc_paa param; /* KDCS parameter area */ struct msg_area { forma3a std_mask; /* Declaration +format forma3 */ ... } msg_a; /* KDCS message area */ }; void cprog (struct ca_area *ca, struct work *spab) {.../* Start of the function area of the program unit */ ...