Step 3—Write the XDR routines
If you used RPCGEN in Step 1, you use the XDR source programs generated by RPCGEN. If the XDR source uses the xdr_char or xdr_u_char XDR library functions, you must use the C #define directive to make the compiler use the xdr_text_char function instead.
If the translations you need can be done by an XDR library function supported by the connection manager (see Table 1 ), you do not need to write an XDR routine. Instead you specify one of the XDR library functions described later when you register a 4-tuple with the connection manager.
If you write your own XDR routine, you need to use the XDR library functions. The full C definitions of these functions are documented in z/OS Communications Server: IP Programmer's Guide and Reference .
CICS® ONC RPC supports only the functions listed in the following table. You should use only these functions in your own XDR routines. These functions convert C data types to XDR formats, and XDR formats to C data types.
| XDR library function | CM | C type |
|---|---|---|
| xdr_int | * | int |
| xdr_u_int | * | unsigned int |
| xdr_long | * | long |
| xdr_u_long | * | unsigned long |
| xdr_short | * | short int |
| xdr_u_short | * | unsigned short int |
| xdr_float | * | float |
| xdr_bool | * | bool_t (see note) |
| xdr_double | * | double |
| xdr_enum | enum | |
| xdr_void | * | void |
| xdr_array | variable-length array | |
| xdr_opaque | fixed-length uninterrupted data | |
| xdr_bytes | variable-length array of bytes | |
| xdr_pointer | object references, including null pointers | |
| xdr_reference | object references | |
| xdr_char | * | character |
| xdr_u_char | * | unsigned character |
| xdr_text_char | * | text character |
| xdr_string | null-terminated character arrays | |
| xdr_vector | fixed-length array with arbitrary element size | |
| xdr_wrapstring | * | variable-length null-terminated character arrays |
| xdr_union | discriminated union |
Names of user-written XDR routines are subject to the same restrictions as CICS programs.
You must take care when writing your own XDR routines. These run in the CICS address space and can overwrite CICS code and other user application storage, because they are defined with EXECKEY(CICS).