Use MSGCON to display a MSGID from a MSGF


Nov 24

By using MSGCON (message constant) keyword.

You use MSGCON, a field-level keyword to declare the text for constant fields is contained in a message description.

Years ago, this was used by a lot of companies to create multilingual display files.

The idea was that you could remove the ENGLISH language fields from every *DSPF and replace with MSGCON links to message files. Then you can ship your application with a ENGLISH, SPANISH, FRENCH or whatever language translated message file and *boom* the application is displayed in that language.

Personally, I found it horrible to work with. Using SDA to edit a screen that is filled with screen constants is a nightmare because you have to be extra careful to keep track of which field is which. But, there I go, digressing into moaning moaney land.

But, it warrants a little explanation in case you are trying to figure it out.

MSGCON (Message Constant) keyword for display files


If the message description does not exist at DDS compilation time, the file will not be created. If you change the message description, you need to create the file again if you want the display file to contain the updated message.

The format of the keyword is:

MSGCON(length message-ID [library-name/]message-file-name)

The message-file-name parameter identifies the message file that contains the message description. The library-name parameter is optional.

The MSGCON keyword must be explicitly specified for the field and cannot be used to initialize a named field.

The DFT and MSGCON keywords are functionally equivalent. If you specify the DFT and MSGCON keywords for the same field, the MSGCON keyword is ignored and the file is not created.

The MSGCON keyword cannot be specified with any of the following keywords:


The following example shows how to specify the MSGCON keyword.

00010A          R RECORD1
00020A                                  2  1MSGCON(10 MSG0001 MESSAGE/MSGF)

MSG0001 in message file MSGF in library MESSAGES contains the message text.


About the Author

IBM i Software Developer, Digital Dad, AS400 Anarchist, RPG Modernizer, Alpha Nerd and Passionate Eater of Cheese and Biscuits. Nick Litten Dot Com is a mixture of blog posts that can be sometimes serious, frequently playful and probably down-right pointless all in the space of a day. Enjoy your stay, feel free to comment and in the words of the most interesting man in the world: Stay thirsty my friend.

%d bloggers like this: