Source for message catalogs

The source for a message catalog is either a source physical file, a stream file, or multiple files. The source contains fields to define set numbers, message numbers, message text, or to specify sets to delete.

The following topics provide additional information and examples relating to message catalogs.

Message catalog source format

A message catalog contains five fields of message text source lines. A single blank character separates each of the five fields. Any other blank characters are considered as part of the subsequent field data. See Special characters and escape sequences for additional information.

Note: Enter the key fields exactly as in the following list, using the dollar sign ($) and lowercase characters. Definitions for maximum and minimum values are stored in QSYSINC/QSYS/LIMITS.

Messages programming format

MESSAGES should follow these recommendations:

Using multiple source files

You can specify multiple source files for the source file parameter. The messages that are contained in all of the files must follow the same rules for sets and messages as defined in a single source file. For example, the first source file contains messages in sets 1 through 3. The next source file must begin with set 3 and have a message number greater than the last message number in the first source file. If not, it must contain sets that begin with a number higher than the highest number (set 3) in the previous source file.

Replacing messages

Messages in an existing message catalog can be replaced by specifying a source file that contains the same set number and message number as the message text you want to change. All other messages in the source file remain the same. To update a value for the $QUOTE in a catalog, use the same $QUOTE character in subsequent source files.

Example source for a message catalog

Here is a sample format for the source that is used to create a message catalog. A quotation mark delineates each message. The message text that is stored in the message catalog has had the extraneous blank characters removed. This example describes three sets of messages. Set 2 is deleted while sets 1 and 3 remain stored in the message catalog.

$ Messages for my new product
$quote "
 
$set 1
 
1 "Error occurred.\n"
$ The next message is continued on the next line.
2 "This is a very long message \n\
\t that requires another line to display. \n"
3 "Specify a value greater than %d.\n"
4 "File %c cannot be used at this time.\n"
 
$set 2
1 "Error %d occurred. \n"
2 "Flag not set.\n"
3 "Number of arguments must be %d.\n"
 
$set 4
1 "Before using this command, you must \
set the correct values in the %c box.\n"
2 "You have not properly NLS enabled this function.\n"
10 "Messages should end with a %c.\n"
 
$delset 2
Note: Message 2 in set 1 will be displayed in two lines. Message 1 in set 4 will display as a one line message.

Here is an example for using the MRGMSGCLG command to create a message catalog.

MRGMSGCLG CLGFILE('/MYPRODUCT/MESSAGES?US')
     SRCFILE('QSYS.LIB/MYLIB.LIB/MYSOURCE.FILE/US.MBR')
     CLGCCSID(*SRCCCSID) SRCCCSID(*SRCFILE)
     TEXT('Message catalog for USA')

This example creates a message catalog into the stream file US in directory /MYPRODUCT/MESSAGES using the source from MYLIB library in file MYSOURCE and member US. The CCSID of the data in the message catalog is the same as the CCSID tag of the source file.

Special characters and escape sequences

Text strings can contain special characters and escape sequences as defined in the following table.

Description of special characters Sequence
\ \\
backspace \b
carriage return \r
form feed \f
horizontal tab \t
NEWLINE \n
octal bit pattern \ddd
Note: The escape sequence \ddd consists of a backslash followed by up to three octal digits that specify the value of the required character. If the character following the backslash is not an octal digit, the backslash and data following are included as part of the text.