ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » IIB9: TCPIP Nodes : Message Header in ESQL

Post new topic  Reply to topic
 IIB9: TCPIP Nodes : Message Header in ESQL « View previous topic :: View next topic » 
Author Message
akil
PostPosted: Tue Jun 16, 2015 5:47 am    Post subject: IIB9: TCPIP Nodes : Message Header in ESQL Reply with quote

Partisan

Joined: 27 May 2014
Posts: 338
Location: Mumbai

I searched pretty much for a couple of hours in the forum, and tried for another couple of hours , but could not figure out how to do the following in ESQL.

So, I have the usual ISO8583 message, that needs to be sent out. The message header however, needs to be a 2 byte big endian. The "C" code is as follows

Code:

int counter , msglgth
char buffer[1024];
buffer[0] = counter =msglgth/256;
buffer[1] = msglgth – counter*256;


I am unable to figure out how to do this in ESQL.

I've reached till the following - ( the length comes out to be 67 in the my test message )

Code:

      DECLARE cHeader CHAR;
      DECLARE iMsgLen, iMsgModDiv, iMsgModLen INTEGER;
      DECLARE subBitStream BLOB ASBITSTREAM(InputRoot.DFDL CCSID 1208);
       
      SET iMsgLen = LENGTH(subBitStream);
       
      SET iMsgModDiv = TRUNCATE(iMsgLen/256, 0);
      SET iMsgModLen = MOD(iMsgLen, 256);
     
      SET cHeader = CAST(SUBSTRING(CAST(iMsgModDiv AS BIT) FROM 57 FOR 8) AS CHAR) || CAST(SUBSTRING(CAST(iMsgModLen AS BIT) FROM 57 FOR 8) AS CHAR);


The output of the BIT to CHAR as expected is the 'string' representation of the 8 bit array

Code:

B'00000000'B'01000011'ISO0050000400800822000000000000004000000000000000616123731162037301\x03


It needs to be
Code:

0CISO0050000400800822000000000000004000000000000000616123731162037301\x03


How do I get the bit to its binary (single byte) representation?
_________________
Regards
Back to top
View user's profile Send private message Visit poster's website
mqjeff
PostPosted: Tue Jun 16, 2015 5:54 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

You need to cast to a BLOB and use an Encoding that indicates a big-endian output. And you might need a CCSID as well.
Back to top
View user's profile Send private message
akil
PostPosted: Tue Jun 16, 2015 6:14 am    Post subject: Reply with quote

Partisan

Joined: 27 May 2014
Posts: 338
Location: Mumbai

Hi

This worked! , thank you.

Code:

      SET cHeader = CAST(SUBSTRING(CAST(iMsgModDiv AS BIT) FROM 57 FOR 8) AS BLOB CCSID 819 ENCODING MQENC_INTEGER_NORMAL) || CAST(SUBSTRING(CAST(iMsgModLen AS BIT) FROM 57 FOR 8) AS BLOB CCSID 819 ENCODING MQENC_INTEGER_NORMAL);


Code:

\x00CISO005000040080082200000000000000400000000000

_________________
Regards
Back to top
View user's profile Send private message Visit poster's website
mqjeff
PostPosted: Tue Jun 16, 2015 6:32 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

Without at least a CCSID, CAST doesn't know what binary values represent what characters, so it has to just give you a hex string.

the encoding ensures that you get your numbers in the right order.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » IIB9: TCPIP Nodes : Message Header in ESQL
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.