z/OS Communications Server: IP Programmer's Guide and Reference
Previous topic | Next topic | Contents | Contact z/OS | Library | PDF


Converting C identifiers using the CPP program

z/OS Communications Server: IP Programmer's Guide and Reference
SC27-3659-02

All of the NCS RPC run-time library routines and most of the NCS constants and data types contain a $ character. For example, the routine you call to register your server with RPC run-time is rpc_$register. The routine you call to register your server with the location broker is lb_$register.

IBM® C/370™, based on ANSI standards, does not allow a $ to be used as a correct character in a C identifier. The IBM C/370 preprocessor does not allow you to redefine a $ to another character. NCS provides a routine called CPP for systems that do not allow a $ in C identifiers. The NCS CPP program reads a C source data set, expands macros and include data sets, and writes an input for the C compiler. The most important function that the CPP program performs for MVS™ NCS users is that it converts every $ to an underscore (_) when it occurs in a C identifier.

Before any of your code or the stub code can be compiled, all occurrences of a $ in a C identifier must be converted to an underscore (_). NCS uses CPP to do this.
Note: Because CPP does not contain all the functions of the C/370 preprocessor, there can be times when you need to modify your code to make it acceptable to CPP, even though C/370 might have accepted it.

A CLIST called RUNCPP is provided to assist you in invoking the CPP program. You can use this CLIST, or invoke CPP directly. RUNCPP is a member of SEZAINST.

Use the RUNCPP CLIST command in the following format:

Read syntax diagramSkip visual syntax diagram
>>-RUNCPP--data_set_name--data_set_type------------------------><

Parameter
Description
data_set_name
Specifies the name of the data set used as input to NCS CPP.
data_set_type
Specifies the data set type.
To run CPP with the data set BANK.C@CSTUB as input, enter the following:
RUNCPP BANK C@CSTUB

The RUNCPP CLIST has the most frequently used CPP run-time options hard coded into it. IBM recommends using RUNCPP, but if you must use options that are not specified with RUNCPP, invoke CPP directly.

For portability reasons, you should leave the $ in all the RPC run-time routines, constants, and data types. CPP should be run against your code after you run NIDL. In this way, the client stub and switch or server stub can be moved to a system that supports the $. For portability to other systems, you should always maintain the version of your code that contains the $.

For programs that are not run on any system other than IBM MVS, you can permanently change $ to (_), so that you do not have to use CPP. Then, only the client stub and switch or the server stub has to be run through the CPP routine. In some cases, this is the preferred solution, especially if you need the full function of the C/C++ for z/OS® preprocessor and compiler and CPP does not include this support. For example, many AD/Cycle C/370 header files contain preprocessor directives that CPP does not understand. If you are including AD/Cycle C/370 header files in your application, you should manually change $ to underscore (_) in your application and any included header files so that you do not have to run CPP.

CPP does not support C include files that are members of a partitioned data set. Any NCS C header files that are included by your data set must be copied to your user ID. The following are the members of SEZACMAC that you might need to copy:
Member
Data set name
ncssock1
user_id.socket.h
ncsrpc
user_id.rpc.h
base
user_id.base.h
conv
user_id.conv.h
glb
user_id.glb.h
bsdtocms
user_id.bsdtocms.h
idl@base
user_id.idl@base.h
lb
user_id.lb.h
llb
user_id.llb.h
nbase
user_id.nbase.h
ncsdefs
user_id.ncfdefs.h
ncssock
user_id.ncssock.h
pfm
user_id.pfm.h
rrpc
user_id.rrpc.h
uuid
user_id.uuid.h
Any C/370 standard header files that are included by your data set must be copied from the C/370 product header partitioned data set (SEZACMAC).

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014