Use MSGCON to display a MSGID from a MSGF

  • Home
  • /
  • Blog
  • /
  • Use MSGCON to display a MSGID from a MSGF

November 24, 2016

Use MSGCON to display a MSGID from a MSGF

By NickLitten

November 24, 2016

dds, MSGCON

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

MSGCON

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:
DATE
DFT
EDTCDE
EDTWRD
TIME

Example

The following example shows how to specify the MSGCON keyword.

|...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8
00010A          R RECORD1
00020A                                  2  1MSGCON(10 MSG0001 MESSAGE/MSGF)
     A

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

{"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}

Join the IBM i Community for FREE Presentations, Lessons, Hints and Tips

>