### MKCATDEF - Preprocess Message Source File Utility (OS/2, Windows)

The Preprocess Message Source File Utility (MKCATDEF) preprocesses a message source file for input to GENCAT. It reads a message source file containing symbolic identifiers and produces the following output:

- A HeaderFile, containing statements that equate symbolic identifiers with the set numbers and message ID numbers assigned by MKCATDEF. You must include the HeaderFile in your application program to associate the symbolic names to the set and message numbers assigned by MKCATDEF.
- A new message source file containing message numbers instead of symbolic message identifiers. This output is suitable for input to GENCAT.

MKCATDEF sends the new message source file, with numbers instead of symbolic identifiers, to standard output. You can use MKCATDEF output as input to GENCAT in the following ways:

- Use MKCATDEF with a redirection symbol (>) to write the new message source to a file. Use this file as input to GENCAT.
- Pipe the MKCATDEF output file directly to GENCAT.

After running MKCATDEF, you can use symbolic names in an application to refer to messages.

Syntax

>     mkcatdef HeaderFile SourceFile ... [ -h ][ -f ]

where:

HeaderFile | the name of the header file that contains the symbolic identifiers. Depending on the flag included, the name will be in the form of either HeaderFile.h or HeaderFile_msg.h
SourceFile | the name of the file that will contain the message text.

Flags

-h | Suppresses the generation of a header file.
-f | Controls the name of the header file if it is to be created. By specifying the -f option, the header file name will take the form of HeaderFile.h. Neglecting the flag will generate a file name in the form of HeaderFile_msg.h. If both -h and -f options are specified, the -h action takes precedence over the -f option and therefore, no header file will be generated.

Example
To process the SYMB.MSG message source file and redirect the output to the SYMB.SRC file, enter:

>     mkcatdef symb symb.msg > symb.src

The SYMB.MSG file used in the process looks like so:

>     $ This is an example of a mnemonic source file for messages.
>     $ For comments, use the dollar symbol plus a blank.
>     $ For symbol definitions, use the dollar symbol followed by
>     $ the definition.  An example of a definition:
>     $quote "

>     $ For set definitions, use the dollar symbol plus the
>     $ immediate set:
>     $set MS_SET1  This is set of one of the messages

>     MSG_1 "On: %2$s at: %3$s the file: %1$s was printed on printer: %4$s.\n"

>     $ Define a new quote character for purposes of illustration:
>     $quote '

>     $set MS_SET2 This is set 2 of messages

>     EMSG_1  'This is a message from the message catalog\n"

The generated SYMB_MSG.H file looks similar to the following:

>     #ifdef        _H_SYMB_MSG
>     #define       _H_SYMB_MSG
>     #include <limits.h>
>     #include <nl_types.h>
>     #define       MF_SYMB "symb.cat"
>     /* The following was generated from symb.src. */
>     /* definitions for set MSFAC */
>     #define       SYM_FORM        1
>     #define       SYM_LEN 2
>     #define       MSG_H   6
>     #endif

MKCATDEF also creates the SYMB.SRC message catalog source file for the gencat command with numbers assigned to the symbolic identifiers:

>     $quote " Use double quotation marks to delimit message text
>     $delset 1
>     $set 1
>     1     "Symbolic identifiers can only contain alphanumeric \
>     characters or the _ (underscore character) but must begin with \
>     an alpha or _ character\n"
>     2     "Symbolic identifiers cannot be more than 64 \
>     characters long\n"
>     5     "You can mix symbolic identifiers and numbers\n"
>     $quote
>     6     remember to include the "msg_h" file in your program

The assigned message numbers are noncontiguous because the source file contained a specific number. MKCATDEF always assigns the previous number plus 1 to a symbolic identifier.

Note: MKCATDEF inserts a $delset command before a $set command in the output message source file. This means you cannot add, delete, or replace single messages in an existing catalog when piping to the gencat command. You must enter all messages in the set.

GENCAT - Generate Message Catalog Utility
RUNCAT - Running Message Catalog File Utility