Text can be stored externally from the source code in a separate message file but is bound into the object when it is created.
This technique can be used for:
For device files (display and printer), the message is referred to by the Message Constant (MSGCON) keyword in the DDS source specifications.
For example:
A line pos MSGCON(length message-ID[*libl/]message-file-name) ^ includes expansion space
For user commands, the message identifier xxxnnnn is specified on the PROMPT keyword instead of a literal. The message file is referred to on the Create Command (CRTCMD) command.
For example:
CMD PROMPT(xxxnnnn)
The message file name message-file-name is in a source file referred to by the following command.
CRTCMD CMD(command-name) PGM(library-name/program-name) + PMTFILE([*libl/]message-file-name)
Before the object can be created, you must enter the message description into the specified message file. Enter the message description using the Add Message Description (ADDMSGD) command.
For example:
ADDMSGD MSGID(xxxnnnn) MSGF(library-name/message-file-name) + MSG('Text ')
where xxxnnnn is the message identifier.
This technique allows you to create any number of objects in different languages and to put them into different libraries using the same source code by just assigning another message file at object creation time.
The message file is needed only during the creation of the object. Consider specifying the appropriate length for different languages on the MSGCON keyword. Then make the length information available to the translator.
The following figure shows how early message binding works:
At file creation time, you can choose the appropriate textual data of the language version you want to work with by setting up the library list with the specific library containing the textual data and the program library.