AS/400 Primary Language

15 pts.
AS/400 Primary Language CL RPG

I developed an application in CL and RPG and I want it to be multilingual. Is it possible to programmatically read the system primary language so I can use the same language for my application?[o:p][/o:p]


Answer Wiki

Thanks. We'll let you know when a new response is added.

To answer your specific question (which I suspect is not your real question), you can programmatically read the system primary language using the Retrieve Product Information API QSZRTVPR.

The following CL program will display the primary language of the operating system.

Dcl &Rcv *Char 100
Dcl &LenRcv *Int Value(100)
Dcl &PrdID *Char 28 Value('*OPSYS *CUR 0000*CODE')
Dcl &ErrCde *Int Value(0)

Call QSZRTVPR (&Rcv &LenRcv 'PRDR0100' &PrdID &ErrCde)
SndPgmMsg (%sst(&Rcv 89 4))


Though the system value QLANGID is initially set on a new install based on the primary national language version (NLV) of the system, after that point it is independent of the primary NLV.

As you can see from other responses there are also various ways to externalize text from your application logic.



I am assuming that this is an interactive program and you need the descriptions on the screen to be multilingual.
If that is the case, do not put the descriptions in the source for the DSPF.
Instead, put in fields that can be populate with values.
You can either store this values in tables or arrays.
Another technique is to put them in message files and retrieve them.


This can be done with message files. A different message file would be chosen (or installed or accessed by library list or…) based on user (or system or application or…) setting. Message files are handy for interaction with display files. Each message description text can be different length up to almost the size of the display. Updates can be fairly easily done by message ID. No file I/O needs to be involved.

Note that program constants/literals might also be retrieved from the same message file that was chosen when the display message file was assigned.


Discuss This Question: 4  Replies

There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.
  • ElTerrifico
    The language identifier (QLANGID) system value specifies the default language identifier for the system. The CL command RTVSYSVAL SYSVAL(QLANGID) RTNVAR(&RTNVAR) will return the language identifer to your program in the variable &RTNVAR
    620 pointsBadges:
  • BobIV
    Thanks for the answers. That's exactly what I have done. I made two different message files, one in English and one in French. The problem is to automatically select the proper file based on the system language. I have two AS/400s here: one installed with English as primary language and the other with French as primary language. The last one also has English installed as secondary language. I planned to use the QLANGID system value but when I verified on my two AS/400s, both had ENU (for US English) as value. Even if the French system has ENU value, all system menus are in French. That made me think I could not use this value to determine what language I should use. In fact, I probably don’t understand clearly the purpose of this value. Why all the system menus are still in French if the English language is selected in QLANGID? I verified in my user profile and the language identifier is set to *SYSVAL so it is supposed to use QLANGID system value. So the final question is: should I use the QLANGID value and show English menus or read the system primary language and display French menus? Pierre
    15 pointsBadges:
  • TomLiotta
    Pierre: When you logon and see English while French is the primary language, DSPLIBL to see the SYS libraries in the list. Then DSPSYSVAL QSYSLIBL to compare the two. If there is a difference, look at the *SBSD for whatever subsystem your job is running in. A subsystem has an 'Operational attribute' that can add a language library to the system portion of jobs that run in the subsystem. That might be a way it's affected on the dual-language system. Also, you might want to review manuals for the System Manager product from IBM. You probably don't want to use that product, but it has a bunch of useful concepts built into it. After getting a feel for what System Manager can do for languages, look into technical details of the software product APIs. (Bruce gave an example of one of them.) Concepts out of System Manager plus some technical details from the APIs might help in getting the basic ideas. Tom
    125,585 pointsBadges:
  • bvining
    The QLANGID system value does have a purpose but, as you found out and I mentioned previously, that purpose has nothing to do with what national language is shown on system display panels. QLANGID (or more properly the job LANGID which is generally inherited from the system QLANGID) can be used to control how characters are to be sorted when cultural sorts are needed (different national languages/cultures can prefer different sort sequences when working with extended characters), what CCSID should be used when creating a file containing character data, etc. So to answer your "final" question -- I would NOT use QLANGID to determine what national language should be used for display purposes.
    7,070 pointsBadges:

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

Thanks! We'll email you when relevant content is added and updated.


Share this item with your network: