MQ

 View Only
  • 1.  CCSID Code pages CHCP and display Euro symbol €

    Posted Thu February 08, 2024 10:18 AM

    Hi! 

    This topic has always confused me and continues to do so... to display the euro symbol. In this example I have a DOS prompt (the box is Windows 7...) and a V9.0 queue manager. 
    I do, with the sample apps, a put, a browse and a get. In the put operation a € is written "123 ABC #$€" is the message. When I do the get, a "?" is returned instead "€" and my question is why this happens? What do I need to do, to do the get and display the € symbol?  

    Thanks! 

    C:\Users\Joao>chcp
    Active code page: 850
    
    C:\Users\Joao>echo dis qmgr ccsid | runmqsc MQSENDER
    5724-H72 (C) Copyright IBM Corp. 1994, 2018.
    
         1 : dis qmgr ccsid
    
       QMNAME(MQSENDER)                        CCSID(850)
    
    C:\Users\Joao>echo "123 ABC #$€" | amqsput QL1 MQSENDER
    Sample AMQSPUT0 start
    target queue is QL1
    Sample AMQSPUT0 end
    
    C:\Users\Joao>amqsbcg QL1 MQSENDER
    
    AMQSBCG0 - starts here
    **********************
    
     MQOPEN - 'QL1'
    
    
     MQGET of message number 1, CompCode:0 Reason:0
    ****Message descriptor****
    
      StrucId  : 'MD  '  Version : 2
      Report   : 0  MsgType : 8
      Expiry   : -1  Feedback : 0
      Encoding : 546  CodedCharSetId : 850
      Format : 'MQSTR   '
      Priority : 0  Persistence : 0
      MsgId : X'414D51204D5153454E4445522020202017CDC4652596F506'
      CorrelId : X'000000000000000000000000000000000000000000000000'
      BackoutCount : 0
      ReplyToQ       : '                                                '
      ReplyToQMgr    : 'MQSENDER                                        '
      ** Identity Context
      UserIdentifier : 'Joao        '
      AccountingToken :
       X'16010515000000C7B63CC233C815FB94A77D3BE803000000000000000000000B'
      ApplIdentityData : '                                '
      ** Origin Context
      PutApplType    : '11'
      PutApplName    : ':\IBM\MQV8\bin64\amqsput.exe'
      PutDate  : '20240208'    PutTime  : '14581561'
      ApplOriginData : '    '
    
      GroupId : X'000000000000000000000000000000000000000000000000'
      MsgSeqNumber   : '1'
      Offset         : '0'
      MsgFlags       : '0'
      OriginalLength : '-1'
    
    ****   Message      ****
    
     length - 14 of 14 bytes
    
    00000000:  2231 3233 2041 4243 2023 243F 2220      '"123 ABC #$?"   '
    
     No more messages
     MQCLOSE
     MQDISC
    
    C:\Users\Joao>amqsget  QL1 MQSENDER
    Sample AMQSGET0 start
    message <"123 ABC #$?" >


    ------------------------------
    Joao Ramires
    ------------------------------


  • 2.  RE: CCSID Code pages CHCP and display Euro symbol €

    Posted Thu February 08, 2024 05:34 PM

    I think the issue has to do with the 850 CCSID not supporting the euro symbol. It looks like you might need to switch to CCSID 858 to have euro symbol support for a Windows dos command prompt. However, I recommend you research it further on your end to confirm.



    ------------------------------
    Tim Zielke
    ------------------------------



  • 3.  RE: CCSID Code pages CHCP and display Euro symbol €

    IBM Champion
    Posted Fri February 09, 2024 05:29 AM

    To make sure you never loose any symbol in any language, you should set your codpage to UTF-8 and the CCSID of the qmgr  to 1208.

    Have fun.



    ------------------------------
    Francois Brandelik
    ------------------------------



  • 4.  RE: CCSID Code pages CHCP and display Euro symbol €

    Posted Fri February 09, 2024 06:30 AM

    Thanks Tim and Francois! 

    If I change CHCP to 858 (in DOS command prompt) do the amqsput / get the € is displayed correctly. If I change CHCP tp 65001 and queue manager CCSID to 1208, I have two issues: in DOS command prompt portuguese characters are not correctly displayed, and some become control characters, and the € symbol isn't correctly displayed.


    First case: 

    C:\Users\Joao>chcp
    Active code page: 858
    
    C:\Users\Joao>echo dis qmgr ccsid | runmqsc  MQSENDER
         1 : dis qmgr ccsid
       QMNAME(MQSENDER)                        CCSID(850)
    ...
    C:\Users\Joao>echo "123 ABC #$€" | amqsput QL1 MQSENDER
    Sample AMQSPUT0 start
    target queue is QL1
    Sample AMQSPUT0 end
    
    C:\Users\Joao>amqsget  QL1 MQSENDER
    Sample AMQSGET0 start
    message <"123 ABC #$€" >

    Second case (note the get hangs on "#$â" I need a ctrl-c to break) 

    C:\Users\Joao>chcp
    Active code page: 65001
    
    C:\Users\Joao>echo dis qmgr ccsid | runmqsc  MQSENDER
    
         1 : dis qmgr ccsid
    AMQ8408I: Informaç   QMNAME(MQSENDER)                        CCSID(1208)
    C:\Users\Joao>echo "123 ABC #$€" | amqsput QL1 MQSENDER
    Sample AMQSPUT0 start
    target queue is QL1
    Sample AMQSPUT0 end
    
    C:\Users\Joao>amqsget  QL1 MQSENDER
    Sample AMQSGET0 start
    message <"123 ABC #$â


    ------------------------------
    Joao Ramires
    ------------------------------



  • 5.  RE: CCSID Code pages CHCP and display Euro symbol €

    Posted Fri February 09, 2024 09:11 AM
    Edited by Rich Harran Fri February 09, 2024 09:13 AM

    Doing a put and a get to a local queue with these samples won't result in MQ doing any data conversion. All three samples do put or get with the CodedCharSetId (CCSID) in the MQMD set to MQCCSI_Q_MGR, and only amqsget specifies the get with convert option anyway.

    The bytes that are put are what amqsput0 has in its buffer as a result of calling fgets() on stdin, and what happens at the terminal is a result of amqsget calling printf() on the data that has passed through MQ unchanged. amqsbcg converts non-printable single-byte characters into '.' so it can handle non-text data, and will show the hex values of the individual bytes.

    I think you have found that CCSID 858 is suitable for your application and terminal, but 65001 (utf-8) is not. This might be because fgets() and/or printf() are not suitable for multi-byte utf-8 characters on Windows (I don't know).

    You also seem to see that setting the terminal CCSID to 858 and the queue manger CCSID to 850 works well (and you would see the same for any queue manager CCSID).  However, the CCSID in the MQMD for the message won't be correct for the data. If an application did a get with convert specifying a different CCSID than the queue manager CCSID, the data would be converted from the queue manager CCSID when it is actually in 858. This is because amqsput is setting the CCSID to MQCCSI_Q_MGR.

    A real application should set the CCSID to match the data for MQPUT and can set the required CCSID for MQGET and request get with convert. If you do that, then you could set the queue manager CCSID to 1208 and the terminal and application CCSID to 858.

    You can use the client versions of the samples, amqsputc and amqsgetc and these will treat MQCCSI_Q_MGR as the CCSID of the client environment which should also work. This still won't mean that there's any data conversion done by MQ, because the CCSID in the MQMD in the message will be set to 858, the get will request conversion to 858, so no conversion is needed. 



    ------------------------------
    Rich Harran
    ------------------------------



  • 6.  RE: CCSID Code pages CHCP and display Euro symbol €

    Posted Fri February 09, 2024 01:09 PM
    Edited by Joao Ramires Fri February 09, 2024 01:54 PM

    Thank Rich, very detailed explanation! I need to read more about this subject!



    ------------------------------
    Joao Ramires
    ------------------------------