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 » ESQL code generator

Post new topic  Reply to topic Goto page 1, 2  Next
 ESQL code generator « View previous topic :: View next topic » 
Author Message
shalabh1976
PostPosted: Thu Sep 19, 2013 9:09 pm    Post subject: ESQL code generator Reply with quote

Partisan

Joined: 18 Jul 2002
Posts: 381
Location: Gurgaon, India

I have a requirement to generate large XML (>500 lines) as output from my code (There at 15-20 different XML's). The output XML samples are available. Now it will be helpful if I have a skeleton ESQL code for the basic XML available. Is there any ESQL code generator available that gives an ESQL string as output for a given XML as input. I can then customize this skeleton code but the major code generation would have been done.
For e.g. Input XML (very simple) is <Root><Data>123</Data></Root> will give an output SET OutputRoot.XMLNSC.Root.Data = '123';
_________________
Shalabh
IBM Cert. WMB V6.0
IBM Cert. MQ V5.3 App. Prog.
IBM Cert. DB2 9 DB Associate
Back to top
View user's profile Send private message Yahoo Messenger MSN Messenger
Simbu
PostPosted: Thu Sep 19, 2013 9:25 pm    Post subject: Re: ESQL code generator Reply with quote

Master

Joined: 17 Jun 2011
Posts: 289
Location: Tamil Nadu, India

shalabh1976 wrote:
I have a requirement to generate large XML (>500 lines) as output from my code (There at 15-20 different XML's). The output XML samples are available. Now it will be helpful if I have a skeleton ESQL code for the basic XML available. Is there any ESQL code generator available that gives an ESQL string as output for a given XML as input. I can then customize this skeleton code but the major code generation would have been done.
For e.g. Input XML (very simple) is <Root><Data>123</Data></Root> will give an output SET OutputRoot.XMLNSC.Root.Data = '123';


Below is the steps I followed when I had the same scenario some months before to generate ESQL code.

1. Open RfhUtil
2. Open File
3. GOTO Data
4. Choose Data Format as PARSED
5. Copy the message Data into TestPad
6. Prefix each line with 'SET OutputRoot.XMLNSC.'
7. Postfix each line with ';'
8. Remove unwanted code.
Back to top
View user's profile Send private message
shalabh1976
PostPosted: Thu Sep 19, 2013 11:54 pm    Post subject: Reply with quote

Partisan

Joined: 18 Jul 2002
Posts: 381
Location: Gurgaon, India

Good starting point, but many lines do not have any assignment so if I add ; at the end ESQL editor throws an error - for e.g.
methodResponse.params.param.value.struct.member
methodResponse.params.param.value.struct.member.name='accountValue1'
methodResponse.params.param.value.struct.member.value

Adding a ';' after each line only makes it valid for line 2.
_________________
Shalabh
IBM Cert. WMB V6.0
IBM Cert. MQ V5.3 App. Prog.
IBM Cert. DB2 9 DB Associate
Back to top
View user's profile Send private message Yahoo Messenger MSN Messenger
shalabh1976
PostPosted: Fri Sep 20, 2013 12:28 am    Post subject: Reply with quote

Partisan

Joined: 18 Jul 2002
Posts: 381
Location: Gurgaon, India

Fixed the problem by making lines not having = end with ='';
However a new problem was discovered for repeating tags. Since the code does not address repeating elements if a tag appears again it overwrites the previous occurrence.
_________________
Shalabh
IBM Cert. WMB V6.0
IBM Cert. MQ V5.3 App. Prog.
IBM Cert. DB2 9 DB Associate
Back to top
View user's profile Send private message Yahoo Messenger MSN Messenger
Tibor
PostPosted: Fri Sep 20, 2013 12:35 am    Post subject: Reply with quote

Grand Master

Joined: 20 May 2001
Posts: 1033
Location: Hungary

And what do you think about writing ESQL code for doing this? In ESQL, you can easily access all the XML elements / attributes.
Back to top
View user's profile Send private message
mqjeff
PostPosted: Fri Sep 20, 2013 1:15 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

Create a version 7.0 map.

Use IA9Y.

http://www-01.ibm.com/support/docview.wss?rs=171&uid=swg24017156&loc=en_US&cs=utf-8&lang=en
Back to top
View user's profile Send private message
dogorsy
PostPosted: Fri Sep 20, 2013 3:23 am    Post subject: Reply with quote

Knight

Joined: 13 Mar 2013
Posts: 553
Location: Home Office

shalabh1976 wrote:
Fixed the problem by making lines not having = end with ='';
However a new problem was discovered for repeating tags. Since the code does not address repeating elements if a tag appears again it overwrites the previous occurrence.


use CREATE LASTCHILD instead of SET
Back to top
View user's profile Send private message
shalabh1976
PostPosted: Sun Sep 22, 2013 10:31 pm    Post subject: Reply with quote

Partisan

Joined: 18 Jul 2002
Posts: 381
Location: Gurgaon, India

Same result with CREATE LASTCHILD.
_________________
Shalabh
IBM Cert. WMB V6.0
IBM Cert. MQ V5.3 App. Prog.
IBM Cert. DB2 9 DB Associate
Back to top
View user's profile Send private message Yahoo Messenger MSN Messenger
dogorsy
PostPosted: Sun Sep 22, 2013 11:25 pm    Post subject: Reply with quote

Knight

Joined: 13 Mar 2013
Posts: 553
Location: Home Office

shalabh1976 wrote:
Same result with CREATE LASTCHILD.


Can you please be more specific ? What did you do ? What do you mean with same result ?
Back to top
View user's profile Send private message
shalabh1976
PostPosted: Mon Sep 23, 2013 12:57 am    Post subject: Reply with quote

Partisan

Joined: 18 Jul 2002
Posts: 381
Location: Gurgaon, India

Replaced all SET Output..................... with CREATE LASTCHILD OF Output.............
Replaced all = with VALUE
Here is a partial XML :
Code:
<?xml version="1.0" encoding="utf-8"?>
<methodResponse>
 <params>
  <param>
   <value>
    <struct>
     <member>
      <name>accountValue1</name>
      <value>
       <string>8626015</string>
      </value>
     </member>
     <member>
      <name>creditClearanceDate</name>
      <value>
       <dateTime.iso8601>20290426T12:00:00+0000</dateTime.iso8601>
      </value>
     </member>
     <member>
      <name>currency1</name>
      <value>
       <string>INR</string>
      </value>
     </member>
     <member>

Equivalent lines from RFHUtil :
Code:
methodResponse
methodResponse.params
methodResponse.params.param
methodResponse.params.param.value
methodResponse.params.param.value.struct
methodResponse.params.param.value.struct.member
methodResponse.params.param.value.struct.member.name='accountValue1'
methodResponse.params.param.value.struct.member.value
methodResponse.params.param.value.struct.member.value.string='8626015'
methodResponse.params.param.value.struct.member
methodResponse.params.param.value.struct.member.name='creditClearanceDate'
methodResponse.params.param.value.struct.member.value
methodResponse.params.param.value.struct.member.value.dateTime.iso8601='20290426T12:00:00+0000'
methodResponse.params.param.value.struct.member
methodResponse.params.param.value.struct.member.name='currency1'
methodResponse.params.param.value.struct.member.value
methodResponse.params.param.value.struct.member.value.string='INR'
methodResponse.params.param.value.struct.member
methodResponse.params.param.value.struct.member.name='dedicatedAccountInformation'
methodResponse.params.param.value.struct.member.value
methodResponse.params.param.value.struct.member.value.array
methodResponse.params.param.value.struct.member.value.array.data
methodResponse.params.param.value.struct.member.value.array.data.value
methodResponse.params.param.value.struct.member.value.array.data.value.struct
methodResponse.params.param.value.struct.member.value.array.data.value.struct.member
methodResponse.params.param.value.struct.member.value.array.data.value.struct.member.name='dedicatedAccountID'
methodResponse.params.param.value.struct.member.value.array.data.value.struct.member.value
methodResponse.params.param.value.struct.member.value.array.data.value.struct.member.value.i4='1'
methodResponse.params.param.value.struct.member.value.array.data.value.struct.member
methodResponse.params.param.value.struct.member.value.array.data.value.struct.member.name='dedicatedAccountValue1'
methodResponse.params.param.value.struct.member.value.array.data.value.struct.member.value
methodResponse.params.param.value.struct.member.value.array.data.value.struct.member.value.string='4200'
methodResponse.params.param.value.struct.member.value.array.data.value.struct.member
methodResponse.params.param.value.struct.member.value.array.data.value.struct.member.name='expiryDate'
methodResponse.params.param.value.struct.member.value.array.data.value.struct.member.value
methodResponse.params.param.value.struct.member.value.array.data.value.struct.member.value.dateTime.iso8601='20130929T12:00:00+0000'

Now I replaced all lines with no = at the end to have =''; also added SET OutputRoot.XMLNSC.
_________________
Shalabh
IBM Cert. WMB V6.0
IBM Cert. MQ V5.3 App. Prog.
IBM Cert. DB2 9 DB Associate
Back to top
View user's profile Send private message Yahoo Messenger MSN Messenger
dogorsy
PostPosted: Mon Sep 23, 2013 1:03 am    Post subject: Reply with quote

Knight

Joined: 13 Mar 2013
Posts: 553
Location: Home Office

shalabh1976 wrote:
Replaced all SET Output..................... with CREATE LASTCHILD OF Output.............
Replaced all = with VALUE


In that case you cannot get the same result. As you are IBM certified, you probably know how to run a user trace and debug your code.
Back to top
View user's profile Send private message
lancelotlinc
PostPosted: Mon Sep 23, 2013 3:05 am    Post subject: Reply with quote

Jedi Knight

Joined: 22 Mar 2010
Posts: 4941
Location: Bloomington, IL USA

dogorsy wrote:
shalabh1976 wrote:
Replaced all SET Output..................... with CREATE LASTCHILD OF Output.............
Replaced all = with VALUE


In that case you cannot get the same result. As you are IBM certified, you probably know how to run a user trace and debug your code.


I have some doubt about this.
_________________
http://leanpub.com/IIB_Tips_and_Tricks
Save $20: Coupon Code: MQSERIES_READER
Back to top
View user's profile Send private message Send e-mail
shalabh1976
PostPosted: Mon Sep 23, 2013 4:02 am    Post subject: Reply with quote

Partisan

Joined: 18 Jul 2002
Posts: 381
Location: Gurgaon, India

I'll let that pass jedi knight.
_________________
Shalabh
IBM Cert. WMB V6.0
IBM Cert. MQ V5.3 App. Prog.
IBM Cert. DB2 9 DB Associate
Back to top
View user's profile Send private message Yahoo Messenger MSN Messenger
fjb_saper
PostPosted: Mon Sep 23, 2013 9:13 am    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

Please note that with the notation you gave us:
Quote:
methodResponse.params.param.value.struct.member.value.dateTime.iso8601='20290426T12:00:00+0000'

you have no way of creating the right tag for the timestamp:

The featured notation would mean:

Code:
<methodResponse>
  <Params>
    <param>
      <value>
        <struct>
          <member>
            <value>
               <dateTime>
                  <iso8601>20290426T12:00:00+0000</iso801>
               </dateTime>
             </value>
........


To use dateTime.iso8601 as a tag name you would need to use "dateTime.iso8601" (with double quotes around it...)

Have fun
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
dogorsy
PostPosted: Mon Sep 23, 2013 2:35 pm    Post subject: Reply with quote

Knight

Joined: 13 Mar 2013
Posts: 553
Location: Home Office

fjb_saper wrote:
Please note that with the notation you gave us:
Quote:
methodResponse.params.param.value.struct.member.value.dateTime.iso8601='20290426T12:00:00+0000'

you have no way of creating the right tag for the timestamp:

The featured notation would mean:

Code:
<methodResponse>
  <Params>
    <param>
      <value>
        <struct>
          <member>
            <value>
               <dateTime>
                  <iso8601>20290426T12:00:00+0000</iso801>
               </dateTime>
             </value>
........


To use dateTime.iso8601 as a tag name you would need to use "dateTime.iso8601" (with double quotes around it...)

Have fun


pardon me ?! where do you see "dateTime.iso8601" as a tag name ? there is a dateTime tag and an iso8601 , nothing wrong with either...
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Goto page 1, 2  Next Page 1 of 2

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » ESQL code generator
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.