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 » Defining input XML fields to an ESQL variable

Post new topic  Reply to topic
 Defining input XML fields to an ESQL variable « View previous topic :: View next topic » 
Author Message
sebastian
PostPosted: Wed May 26, 2004 9:33 am    Post subject: Defining input XML fields to an ESQL variable Reply with quote

Centurion

Joined: 12 Nov 2003
Posts: 110
Location: Philadelphia

I have some huge set statements that I would like to shorten using ESQL defined variables. I have tried several things but have had no success yet. An example of my set statement is as follows:

SET "OutputRoot"."XML"."IDOC"."E2STZUM"."E2STZUTH"."SEGNAM"=
TRIM("InputBody"."OCF_SAP.IC.PMX.BOMMAT03"."OFF_SAP.IFC.BOMMAT03.E2STZUM"."OFF_SAP.IFC.BOMMAT03.E2SZUTH"."OFF_SAP.IFF.BOMMAT03.E2SZUTH"."E1SZUTH_E1SZUTH");

I was trying to define OCF_SAP.IC.PMX.BOMMAT03 as XTAG_1 using the set statment

SET XTAG_1 = 'OCF_SAP.IC.PMX.BOMMAT03';

but the variable does not work when I try to place it in the set statement

SET "OutputRoot"."XML"."IDOC"."E2STZUM"."E2STZUTH"."SEGNAM"=
TRIM("InputBody".XTAG_1."OFF_SAP.IFC.BOMMAT03.E2STZUM"."OFF_SAP.IFC.BOMMAT03.E2SZUTH"."OFF_SAP.IFF.BOMMAT03.E2SZUTH"."E1SZUTH_E1SZUTH");

Does anyone know how I can do this?

thanks,
Seb
_________________
sebastian signature
Back to top
View user's profile Send private message Visit poster's website
jefflowrey
PostPosted: Wed May 26, 2004 10:00 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

You probably need to use {}.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
sebastian
PostPosted: Wed May 26, 2004 10:02 am    Post subject: Reply with quote

Centurion

Joined: 12 Nov 2003
Posts: 110
Location: Philadelphia

Would you use the braces in the variable definition or just references to it in the SET statement?

Seb
_________________
sebastian signature
Back to top
View user's profile Send private message Visit poster's website
jefflowrey
PostPosted: Wed May 26, 2004 10:06 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

Quote:
TRIM("InputBody".{XTAG_1}."OFF_SAP.IFC.BOMMAT03.E2STZUM"

_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
sebastian
PostPosted: Wed May 26, 2004 10:10 am    Post subject: Reply with quote

Centurion

Joined: 12 Nov 2003
Posts: 110
Location: Philadelphia

I just tried that....it gave me a syntax error.

Seb
_________________
sebastian signature
Back to top
View user's profile Send private message Visit poster's website
JT
PostPosted: Wed May 26, 2004 10:45 am    Post subject: Reply with quote

Padawan

Joined: 27 Mar 2003
Posts: 1564
Location: Hartford, CT.

You could try this:
Code:
DECLARE A CHARACTER;
SET A =  FIELDNAME(InputBody.*[1]);
EVAL('SET OutputRoot.XML.IDOC.E2STZUM.E2STZUTH.SEGNAM = InputBody."' || A || '"."OFF_SAP.IFC.BOMMAT03.E2STZUM"."OFF_SAP.IFC.BOMMAT03.E2SZUTH"."OFF_SAP.IFF.BOMMAT03.E2SZUTH"."E1SZUTH_E1SZUTH";');
Back to top
View user's profile Send private message
mgk
PostPosted: Fri May 28, 2004 4:33 am    Post subject: Reply with quote

Padawan

Joined: 31 Jul 2003
Posts: 1642

Expressions in field references ( { } in a path ) only works for a single element, not multiple elements at once.

However, please try to avoid EVAL just to simplify your typing as the previous poster implied. EVAL is slow, as it is effectively a NESTED COMPUTE NODE and should only be used when you really cannot do anything else.

Here, the "anything else" is to type a few more characters, which will give you a huge performance boost over using EVAL

Cheers,
_________________
MGK
The postings I make on this site are my own and don't necessarily represent IBM's positions, strategies or opinions.
Back to top
View user's profile Send private message
mgk
PostPosted: Fri May 28, 2004 4:35 am    Post subject: Reply with quote

Padawan

Joined: 31 Jul 2003
Posts: 1642

Further to my last post, you can effectively shorten the path by declaring a REFERENCE variable to point into the path, and simply index of that. This will actually be faster that a deep SET statement.

Cheers,
_________________
MGK
The postings I make on this site are my own and don't necessarily represent IBM's positions, strategies or opinions.
Back to top
View user's profile Send private message
catwood2
PostPosted: Fri May 28, 2004 7:37 am    Post subject: Reply with quote

Centurion

Joined: 17 May 2002
Posts: 108

Quote:
Here, the "anything else" is to type a few more characters, which will give you a huge performance boost over using EVAL


I don't see the alternative to using the EVAL in this thread. Could you please elaborate? I would really appreciate it as I have read repeatedly on the board about the EVAL performance hit, etc....but, I don't see where you get around it in this example (a variable storing multiple nodes being used to complete the path).
thanks
Back to top
View user's profile Send private message
mgk
PostPosted: Tue Jun 01, 2004 4:39 am    Post subject: Reply with quote

Padawan

Joined: 31 Jul 2003
Posts: 1642

Well if you could change you design slightly then the following should work
(note this is not tested, but should be about right...)

DECLARE xTagRef REFERENCE TO InputBody."OCF_SAP".IC.PMX.BOMMAT03;

DECLARE outTagRef REFERENCE TO OutputRoot.XML.IDOC.E2STZUM.E2STZUTH;

SET outTagRef.SEGNAM = TRIM( xTagRef."OFF_SAP.IFC.BOMMAT03.E2STZUM"."OFF_SAP.IFC.BOMMAT03.E2SZUTH"."OFF_SAP.IFF.BOMMAT03.E2SZUTH"."E1SZUTH_E1SZUTH");

Cheers,
_________________
MGK
The postings I make on this site are my own and don't necessarily represent IBM's positions, strategies or opinions.
Back to top
View user's profile Send private message
sebastian
PostPosted: Tue Jun 01, 2004 10:18 am    Post subject: Reply with quote

Centurion

Joined: 12 Nov 2003
Posts: 110
Location: Philadelphia

If you can assign these variables, is there a way in ESQL to branch to a common code subroutine?

The code examples I have are very large and repetitive.

Sebastian
_________________
sebastian signature
Back to top
View user's profile Send private message Visit poster's website
fazz
PostPosted: Tue Jun 01, 2004 11:57 pm    Post subject: Reply with quote

Centurion

Joined: 20 Feb 2004
Posts: 144
Location: England

You could call a procedure that held the common code.
Below is an extract of code I have used to create an IDOC.

CALL CreateDAndIQuotes ("OutputRoot"."IDOC"."CONTROL_RECORD"."EXCHANGE_RATE01"."E2EXCHANGE_RATE000", InputBody);

CREATE PROCEDURE CreateDAndIQuotes (IN Ref1 REFERENCE,IN Ref2 REFERENCE)

BEGIN

DECLARE refIDOC REFERENCE TO Ref1;
DECLARE refIn REFERENCE TO Ref2;

SET refIDOC."E2BP1093_0001."RATE_TYPE" = refIn."YGKERS01_RATE_TYPE";

END;
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 » Defining input XML fields to an ESQL variable
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.