Author |
Message
|
Suresh Gupta |
Posted: Thu Jul 24, 2008 12:19 am Post subject: Not able to read the data comming from Mainframes |
|
|
Apprentice
Joined: 29 Jun 2005 Posts: 46 Location: India
|
Hi, we are getting reply from Mainframes in MRM format, basically each message is divided into two parts first part is like header which contains some description about the data, second part is Data, In the reply flow I don't want to use any Message Set, so I stored all the message elements and length of each filed in the database. based on the header part I have to construct the response XML, some how I am not able to read only header part, but I am able to read data part ,
First I am reading the whole message in BLOB format and then casting it in to character format using CCSID 500 and encoding 785 ,using the I am not able to read the header part , Data Part is fine, element in Header part are in Packed decimal part of length 3, while I am trying to read the header part I am getting .... dots in the o/p XML ,
can any one suggest how to parse this header part
Thanks in Advance _________________ regards,
Suresh |
|
Back to top |
|
 |
kimbert |
Posted: Thu Jul 24, 2008 3:13 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Quote: |
In the reply flow I don't want to use any Message Set,so I stored all the message elements and length of each filed in the database |
Am I allowed to ask why you don't want to use a message set? I'd really like to know...
Quote: |
First I am reading the whole message in BLOB format and then casting it in to character format using CCSID 500 and encoding 785 ,using the I am not able to read the header part , Data Part is fine, element in Header part are in Packed decimal part of length 3, while I am trying to read the header part I am getting .... dots in the o/p XML |
I'm not sure that I understand. But are you aware that packed decimal is a binary ( non-text ) physical type? |
|
Back to top |
|
 |
Suresh Gupta |
Posted: Thu Jul 24, 2008 3:46 am Post subject: |
|
|
Apprentice
Joined: 29 Jun 2005 Posts: 46 Location: India
|
Thanks for ur Reply, why we are doing this is becoz there are frequent changes to the response message which inturn needs to change message set each time, so inorder to avoid this changes frequently, we are thinking of reading the elements from db, database will be updated by backend people
Can we convert this packed decimal format into readable format say integer format , _________________ regards,
Suresh |
|
Back to top |
|
 |
kimbert |
Posted: Thu Jul 24, 2008 4:12 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Quote: |
why we are doing this is becoz there are frequent changes to the response message which inturn needs to change message set each time |
Can you describe the overall format of the response message?
What exactly is changing? Extra fields? Different data types?
Can the Data part contain non-text fields? ( if not, is there a chance that it might include them in future? )
Does the header ever change?
I hope you already know the answers to these questions - they are key issues which need to be understood *before* you decide on a design for your message flow. |
|
Back to top |
|
 |
paintpot |
Posted: Thu Jul 24, 2008 4:34 am Post subject: |
|
|
Centurion
Joined: 19 Sep 2005 Posts: 112 Location: UK
|
In general, for interfaces with a lot of variance, XML was designed - i.e. it is inherently interoperable. Therefore, the responsibility for this could be passed to the mainframe app.
Otherwise, using an MRM on part of the message is a possibility, but wont save you if your header keeps changing (and you don't want to amend it in WMB).
Another option is to make sure the mainframe app only passes character format data - i.e. all numbers are unpacked. This should allow your dynamic model to work.
Another option is to go for delimited - then you can go for the equivalent of name/value pairs.
Last edited by paintpot on Thu Jul 24, 2008 5:26 am; edited 1 time in total |
|
Back to top |
|
 |
Suresh Gupta |
Posted: Thu Jul 24, 2008 5:15 am Post subject: |
|
|
Apprentice
Joined: 29 Jun 2005 Posts: 46 Location: India
|
Thanks to all for replies, Response is in CWF format, only based on number of records Data part will grow or shrink, header part is always fixed, using header part we can identify whether response is proper or error and number of records in the data part
here is sample header ( after converting in to XML)
<RPCHeader>
<MsgNbr>1</MsgNbr>
<TotMsgs>1</TotMsgs>
<ErrorMsgs>0</ErrorMsgs> // if 0 it is proper response
<NoofRows>1</NoofRows> // total number of records ,
<TotNoofRows>1</TotNoofRows>
</RPCHeader>
based on number of records we have to run the loop on the data part to construct the XML message
I browsed the MRM Message using rfhutl, I am not able to identify the first 24 character which is the header part
here is the snap shot of message
00000000 ........ .......D 00001C00 001C0000 0C00001C 00001CC4
00000016 .......ð 04999022 00001C00 0000138C F0F4F9F9 F9F0F2F2
00000032 90009801 1 ..YESY F9F0F0F0 F9F8F0F1 F1400003 E8C5E2E8
00000048 00..N/A F0F00010 D561C140 40404040 40404040
00000064 X..O PTED OUT 40404040 E70009D6 D7E3C5C4 40D6E4E3
00000080 ..000000 00000000 0013F0F0 F0F0F0F0 F0F0F0F0 F0F0F0F0
00000096 00000..N O 00.. F0F0F0F0 F00003D5 D6404040 F0F00008
00000112 N/A ..N/A D561C140 40404040 40404000 08D561C1
00000128 Y 40404040 40E84040 40404040 40404040
00000144 40404040 40404040 40404040 40404040
00000160 0 40F0
Header part is till ð in second row _________________ regards,
Suresh |
|
Back to top |
|
 |
paintpot |
Posted: Thu Jul 24, 2008 5:45 am Post subject: |
|
|
Centurion
Joined: 19 Sep 2005 Posts: 112 Location: UK
|
Quote: |
00001C00 001C0000 0C00001C 00001C
|
This is your header information (numeric 1 and 1 and 0 and 1 and 1) in fixed decimal (5,0) format.
If you don't want to use MRM for all, then MRM/CWF the first part (as you seem to have done).
Then slice the header off, and convert the data part of the BLOB and process it in your loop.
Looks like you are almost there. |
|
Back to top |
|
 |
Suresh Gupta |
Posted: Thu Jul 24, 2008 6:30 am Post subject: |
|
|
Apprentice
Joined: 29 Jun 2005 Posts: 46 Location: India
|
thanks for u reply, i have given this for example, but we have to read this header part , based on this values only i have to run the loop, without this we can not construct proper XML message
i am trying different options to parse this header part like
CAST( SUBSTRING(InputMsg FROM 1 FOR 24 ) AS CHARACTER CCSID 500)
SET OutputRoot.XML.R1.R2 = SUBSTRING( Hdr FROM 1 FOR 3);
SET OutputRoot.XML.R1.R3 = SUBSTRING( Hdr FROM 4 FOR 3);
SET OutputRoot.XML.R1.R4 = SUBSTRING( Hdr FROM 7 FOR 3);
SET OutputRoot.XML.R1.R5 = SUBSTRING( Hdr FROM 10 FOR 3);
SET OutputRoot.XML.R1.R6 = SUBSTRING( Hdr FROM 13 FOR 3);
SET OutputRoot.XML.R1.R7 = SUBSTRING( Hdr FROM 16 FOR 3);
etc.........
i am reading each digit with length of 3 ,because in the message set it was defined as packed decimal of length 3
can u tell me how to read this header data _________________ regards,
Suresh |
|
Back to top |
|
 |
paintpot |
Posted: Thu Jul 24, 2008 8:11 am Post subject: |
|
|
Centurion
Joined: 19 Sep 2005 Posts: 112 Location: UK
|
Something like:
Code: |
-- I think the start of your header may or may not be at character 1.
-- Check and amend this as required.
SET myBlob = SUBSTRING(InputRoot.BLOB.BLOB FROM 1 FOR 24);
-- convert the BLOB data to the MRM CWF format
SET myHdrChar = (CAST(DataBlob AS CHARACTER CCSID OutputRoot.MQMD.CodedCharSetId));
-- parse the character set
CREATE LASTCHILD OF OutputRoot DOMAIN ('MRM') PARSE(myHdrChar, OutputRoot.MQMD.Encoding, OutputRoot.MQMD.CodedCharSetId, myMessageSet, myMessageSetType, 'CWF');
|
The data will have been converted to numbers, if your message set has been created ok - with a CWF format giving fields of the right size in the right order.
Obviously replace myMessageSet, myMessageSetType with the correct values.
I am a bit worried that your parsing of the non-header data will be very slow, but that is the tradeoff for the flexibility you have gone for. |
|
Back to top |
|
 |
kimbert |
Posted: Thu Jul 24, 2008 11:17 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Please do not use the XML domain in a new message flow - it is deprecated. XMLNSC is the best choice. XMLNS is OK too. In your scenario it is very easy to switch to XMLNS simply by replacing 'XML' with 'XMLNS' throughout your ESQL. |
|
Back to top |
|
 |
|