|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
Question on variable substitution |
« View previous topic :: View next topic » |
Author |
Message
|
petervh1 |
Posted: Mon Aug 25, 2025 3:23 am Post subject: Question on variable substitution |
|
|
Centurion
Joined: 19 Apr 2010 Posts: 140
|
Is there a reason that this works:
Quote: |
IF InputRoot.MQMD.SourceQueue = 'XYZ' THEN
SET Qualifier = 'XMLNSC';
ELSE SET Qualifier = 'JSON.Data';
END IF;
SET OutputRoot.{Qualifier}.Base.XYZ ='1';
|
but this doesn't
Quote: |
IF InputRoot.MQMD.SourceQueue = 'XYZ' THEN
SET Qualifier = 'Environment.Input';
ELSE SET Qualifier = 'InputRoot.JSON.Data';
END IF;
IF {Qualifier}.Base.XYZ ='1' THEN
SET A = 'A';
END IF;
|
I want to set the 'top level' of a reference to either
or
Quote: |
InputRoot.JSON.Data
|
depending on whence a message comes |
|
Back to top |
|
 |
bruce2359 |
Posted: Mon Aug 25, 2025 10:01 am Post subject: |
|
|
 Poobah
Joined: 05 Jan 2008 Posts: 9482 Location: US: west coast, almost. Otherwise, enroute.
|
What precisely doesn?t work? _________________ I like deadlines. I like to wave as they pass by.
ב''ה
Lex Orandi, Lex Credendi, Lex Vivendi. As we Worship, So we Believe, So we Live. |
|
Back to top |
|
 |
petervh1 |
Posted: Mon Aug 25, 2025 9:31 pm Post subject: |
|
|
Centurion
Joined: 19 Apr 2010 Posts: 140
|
Sorry - I should have been more specific:
The failure case gives me an error when I save the ESQL file.
The Problem description in the Toolkit for the line
Code: |
IF {Qualifier}.Base.XYZ ='1' THEN
|
is as follows:
Quote: |
Syntax error. Valid options include: = - ( + .NET CASE CAST COUNT CURRENT_DATE CURRENT_GMTDATE CURRENT_GMTTIME CURRENT_GMTTIMESTAMP CURRENT_TIME CURRENT_TIMESTAMP DATE DECIMAL EVAL EXISTS EXTRACT FALSE FOR GMTTIME GMTTIMESTAMP IDENTIFIER INTERVAL LIST LOCAL_TIMEZONE LOG MAX MIN NOT NULL OVERLAY PARSE PASSTHRU POSITION RAND ROUND ROW SELECT SIMPLE_FUNCTION SUBSTRING SUM THE TIME TIMESTAMP TRIM TRUE UNKNOWN URLENCODE UUIDASBLOB UUIDASCHAR
|
|
|
Back to top |
|
 |
mgk |
Posted: Fri Aug 29, 2025 3:00 am Post subject: |
|
|
 Padawan
Joined: 31 Jul 2003 Posts: 1647
|
The reason
Code: |
IF {Qualifier}.Base.XYZ ='1' THEN |
does not work is that the { ... } syntax is only valid as part of a field reference path element. And a field reference must start with a correlation name and {Qualifier} is not a correlation name.
Also I think the example you say works probably does not do what you think it does. A NameExpression can only replace a single path element, not multiple so SET Qualifier = 'JSON.Data'; will end up creating a single element called "JSON.Data" rather than creating two elements, one called "JSON" and one called "Data"
For more details see:
https://www.ibm.com/docs/en/app-connect/13.0.x?topic=reference-esql-field-overview
To achieve what you are trying to do you could look to write a procedure that MOVEs a REFERENCE that you pass in to the correct place instead and call that when needed?
I hope this helps. _________________ 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 |
|
 |
fjb_saper |
Posted: Sun Aug 31, 2025 6:05 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20767 Location: LI,NY
|
I'm with mgk on that one. Use references... _________________ MQ & Broker admin |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
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
|
|
|
|