Invoking the Header-to-copy Utility

The Header-to-copy utility can be run directly from the command line or it can be invoked automatically using the PREPROCESS(headers) Compiler directive. The Headers preprocessor allows C header files, with an extension of .h, to be specified in a COPY statement in a COBOL source file. The preprocessor recognizes these as C header files and uses the Header-to-copy utility to convert them. This can be very convenient for relatively small header files.

To invoke the Header-to-copy utility from the command line, type:

h2cpy {[filename] [option]} ...

where the parameters are:

filename The C-language header file to be converted to a COBOL copyfile
option An H2cpy command-line option

If you do not specify option or filename, a list of available options is displayed.

Note: C header files that require other header files that have been previously processed in the same run cannot be processed on their own by the C compiler. Similarly, H2cpy can only translate a standalone header file, or a complete set of header files. Any macro-names that need specifying in the C compiler command line, and any macros predefined by a particular compiler, might need to be specified on the H2cpy command line. For example, Microsoft-specific predefined macros include:

CHAR_UNSIGNED
_CPPUNWIND
_DLL
_M_IX86
_MSC_VER
_MT
_WIN32
_CPPRTTI
_M_ALPHA
_M_MPPC
_M_MRXOOO
_M_MPPC
_MFC_VER
_MT

Do not specfiy the __cplusplus macro as H2cpy is not suitable for C++ headers.

ANSI C predefined macros that might need to be specified on the command line using the -D option include:

__DATE__
__FILE__
__LINE__
__STDC__
__TIME__
__TIMESTAMP__

Groups of macro definitions can be held in the h2cpy.dir file. See the h2cpy option -G option for details.

Related Topics: