QRYLANG — Determine languages available for message translation

Description

The QRYLANG macro enables you to check if a particular language is available into which you can translate system or application messages. It can also provide a list of all active languages currently available for translation. Once you know that the language you want is available, you can issue TRANMSG to retrieve the translated message.

QRYLANG returns the information you request in the language query block (LQB). This block contains the following:
  • The standard 3-character code for the language
  • The name of the language
  • A flag indicating whether the language contains double-byte characters

If you asked for a list of all available languages, QRYLANG returns an LQB with one language entry for each language.

See z/OS MVS Programming: Assembler Services Guide for more information on using QRYLANG.

Environment

The requirements for the caller are:

Environmental factor Requirement
Minimum authorization: Problem state and any PSW key
Dispatchable unit mode: Task or SRB
Cross memory mode: PASN=HASN=SASN or PASN¬=HASN¬=SASN
AMODE: 24- or 31-bit
ASC mode: Primary
Interrupt Status: Enabled for I/O and external interrupts
Locks: No locks held
Control parameters: Not applicable

Programming requirements

Before invoking QRYLANG you must allocate storage for the LQB.

You must include the following mapping macros:
  • CNLMLQB
  • CNLMMCA

Restrictions

None.

Input register information

Before issuing the QRYLANG macro, the caller must ensure that the following general purpose register (GPR) contains the specified information:
Register
Contents
13
Points to a save area

Output register information

When control returns to the caller, the output registers contain:
Register
Contents
0
  • The contents of the high-order halfword are not part of the intended programming interface.
  • The low-order halfword contains a reason code.
1
Used as a work register by system
2-13
Unchanged
14
Used as a work register by system
15
Return code

Some callers depend on register contents remaining the same before and after issuing a service. If the system changes the contents of registers on which the caller depends, the caller must save them before issuing the service, and restore them after the system returns control.

Performance implications

None.

Syntax

The QRYLANG macro is written as follows:

Syntax Description
   
    name name: Symbol. Begin name in column 1.
   
One or more blanks must precede QRYLANG.
   
QRYLANG  
   
One or more blanks must follow QRYLANG.
   
LQB=lang qblock addr lang qblock addr: RX-type address or register (2) - (12).
   
   ,LQBLEN=length of block addr length of block addr: RX-type address or register (2) - (12).
   
   ,LANGNAME=lang addr lang addr: RX-type address or register (2) - (12).
   

Parameters

The parameters are explained as follows:

LQB=lang qblock addr
Specifies the storage area or a register pointing to the storage area where QRYLANG is to build the LQB.
,LQBLEN=length of block addr
Specifies the fullword or a register containing the length in bytes of the LQB. You must supply the length of the LQB if you are querying more than one language. See z/OS MVS Programming: Authorized Assembler Services Guide for information on how to calculate the length of the LQB. If you do not specify LQBLEN, QRYLANG will default to the assembled length of the LQB parameter. If you use an RX-type address or register notation for the LQB parameter, you must specify LQBLEN.
,LANGNAME=lang addr
Specifies the 24-byte character field or a register pointing to the 24-byte character field containing the name or code of the language to be queried. See z/OS MVS Programming: Assembler Services Guide for a listing of the language codes. The language name must match the name specified on the NAME parameter of the LANGUAGE statement in the MMSLSTxx member of SYS1.PARMLIB. If you omit this keyword, QRYLANG returns a list of all currently available languages.

Return and reason codes

When QRYLANG completes, register 15 contains one of the following hexadecimal return codes:

Hexadecimal Code Meaning
00 Processing completed successfully.
04 Processing did not complete, and storage is not freed.
08 Processing is complete but QRYLANG returned an incomplete LQB to the calling program. For example, the requested language may not be available.
0C Processing did not complete. The output is unusable.
10 The function did not complete. The output LQB is unusable.

The low-order halfword of register 0 contains the following hexadecimal reason codes from QRYLANG:

Hexadecimal Return Code Hexadecimal Reason Code Meaning
00 00 Successful processing.
04 07 This reason code is for internal diagnostic purposes only. Record it and supply it to the appropriate IBM® support personnel.
04 08 This reason code is for internal diagnostic purposes only. Record it and supply it to the appropriate IBM support personnel.
04 0B This reason code is for internal diagnostic purposes only. Record it and supply it to the appropriate IBM support personnel.
04 0C The passed storage address is not valid.
04 0D This reason code is for internal diagnostic purposes only. Record it and supply it to the appropriate IBM support personnel.
08 0F There is insufficient LQB storage for LQB entries.
08 2C The language you requested is not available.
0C 0A No storage was obtained.
0C 16 The LQB is too small to handle returned data.
0C 17 The MVS™ message service is not available.
0C 26 The query request terminated. The MMS user exit has set the processing indicator to a nonzero value.
0C 27 The entry installation exit has failed.
0C 28 The exit installation exit has failed.
0C 2D The acronym of the control block created when invoking QRYLANG is not "LQB" and is therefore not valid.
0C 2E The length of the LQB is not valid.
0C 2F QRYLANG was unable to move the LQB from the caller's address space.
0C 30 QRYLANG was unable to move the LQB to the caller's address space.
10 09 This reason code is for internal diagnostic purposes only. Record it and supply it to the appropriate IBM support personnel.

Example

Check if the language with a language code of JPN is active. If JPN is active, QUERY2A sets a flag within the installation-created control block to "on", indicating that JPN is available.
QUERY2A  CSECT
QUERY2A  AMODE 31
QUERY2A  RMODE ANY
         STM   14,12,12(13)
         BALR  12,0
         USING *,12
         ST    13,SAVE+4
         LA    15,SAVE
         ST    15,8(13)
         LR    13,15
*                                                                     *
***********************************************************************
*        OBTAIN STORAGE AREA FOR INSTLCB AND LQB                      *
***********************************************************************
*                                                                     *
         GETMAIN RU,LV=STORLEN,SP=SP228
*                                                                     *
         LR    R3,R1                SAVE ADDRESS OF STORAGE AREA
         ST    R3,CVTUSER-CVT(R2)   ANCHOR INSTALLATION CONTROL BLOCK  C
                                    FROM GLOBAL COMMUNICATIONS WORD    C
                                    IN MCA CONTROL BLOCK
         XC    0(STORLEN,3),0(3)    CLEAR STORAGE AREA
         MVC   INSTLACR-INSTLCB(4,R3),=C'INST'  SET ACRONYM IN         C
                                          INSTALLATION CONTROL BLOCK
         LA    R4,INSTLLEN(,R3)     OBTAIN ADDRESS OF LQB
         LA    R5,LQBLEN            GET LQB LENGTH
*                                                                     *
         QRYLANG LANGNAME=JPN_CODE,LQB=(R4),LQBLEN=(R5)
*                                                                     *
         LTR   R15,R15              IS JAPANESE AVAILABLE
         BNZ   END                  NO, EXIT
         OI    INSTLFLG-INSTLCB(R3),INSTLJPN    YES, SET AVAIL. FLAG
*
***********************************************************************
*        RETURN                                                       *
***********************************************************************
*
END      DS    0H
         L     13,SAVE+4
         LM    14,12,12(13)
         BR    14
***********************************************************************
JPN_CODE DC    CL24'JPN'
SAVE     DC    18F'0'
SP228    EQU   228
LQBLEN   EQU   (LQBVDAT-LQB)+LQBEBL
STORLEN  EQU   INSTLLEN+LQBLEN
R1       EQU   1
R2       EQU   2
R3       EQU   3
R4       EQU   4
R5       EQU   5
R15      EQU   15
***********************************************************************
         DSECT
         CVT   DSECT=YES
         CNLMMCA
         CNLMLQB
INSTLCB  DSECT               INSTALLATION CONTROL BLOCK
INSTLACR DS    CL4'INST'     INSTALLATION CONTROL BLOCK ACRONYM
INSTLFLG DS    X             LANGUAGE AVAILABILITY FLAGS
INSTLJPN EQU   X'80'         JAPANESE IS AVAILABLE
         DS    CL23          RESERVED
INSTLLEN EQU   *-INSTLCB
         END QUERY2A