Creating a message catalog

The Message Facility provides commands and subroutines to retrieve and display program messages located in externalized message catalogs. A programmer creates a message source file containing application messages and converts it to a message catalog. Translating message source files into other languages and then converting the files to message catalogs does not require changing or recompiling a program.

To create a message catalog, process your completed message source file with the message facility's gencat command. This command can be used in the following ways:

  • Use the gencat command to process a message source file containing set numbers, message ID numbers, and message text. Message source files containing symbolic identifiers cannot be processed directly by the gencat command. The following example uses the information in the x.msg message source file to generate a catalog file:
    gencat x.cat x.msg
  • Use the mkcatdefs command to preprocess a message source file containing symbolic identifiers. The resulting file is then piped to the gencat command. The mkcatdefs command produces a SymbolName_msg.h file containing definition statements. These statements equate symbolic identifiers with set numbers and message ID numbers assigned by the mkcatdefs command. The SymbolName_msg.h file should be included in programs using these symbolic identifiers. The mkcatdefs command is specific to AIX®. The following example uses the information in the x.msg message source file to generate the x_msg.h header file:
    mkcatdefs x x.msg
  • Use the runcat command to automatically process a source file containing symbolic identifiers. The runcat command invokes the mkcatdefs command and pipes its output to the gencat command. The runcat command is specific to AIX. The following example uses the information in the x.msg message source file to generate the x_msg.h header file and the X.cat catalog file:
    runcat x x.msg
The preceding example is equivalent to the following example:
mkcatdefs x x.msg | gencat x.cat

If a message catalog with the name specified by the CatalogFile parameter exists, the gencat command modifies the catalog according to the statements in the message source files. If a message catalog does not exist, the gencat command creates a catalog file with the name specified by the CatalogFile parameter.

You can specify any number of message text source files. Multiple files are processed in the sequence you specify. Each successive source file modifies the catalog. If you do not specify a source file, the gencat command accepts message source data from standard input.