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 » Build string in ESQL

Post new topic  Reply to topic
 Build string in ESQL « View previous topic :: View next topic » 
Author Message
Blomman
PostPosted: Wed May 19, 2010 3:37 am    Post subject: Build string in ESQL Reply with quote

Master

Joined: 31 Oct 2006
Posts: 230

Hi
I have an simple problem buildning an string with its current value + a new value in ESQL(Newbie on ESQL).
MyString2 never gets any value...

Something like this:

Code:

DECLARE "all variables"

SET integer k=1
SET integer j=5

WHILE k<j DO
   SET MyString="NewStringValueEachTurnInLoop";
   SET MyString2 = MyString2 || MyString || ".";
SET k = k + 1;
END WHILE;


MyString2 should look for example like this when loop is done:
"value1.value2.value3.value4.value5."

Best Regards!

//Blomman
Back to top
View user's profile Send private message
Svp
PostPosted: Wed May 19, 2010 4:16 am    Post subject: Reply with quote

Apprentice

Joined: 18 Feb 2010
Posts: 40

Declare MyString2 = '';
Back to top
View user's profile Send private message
vmcgloin
PostPosted: Wed May 19, 2010 4:25 am    Post subject: Reply with quote

Knight

Joined: 04 Apr 2002
Posts: 560
Location: Scotland

Try using single quotes instead of double quotes e.g. around '.'
Back to top
View user's profile Send private message
Svp
PostPosted: Wed May 19, 2010 4:28 am    Post subject: Reply with quote

Apprentice

Joined: 18 Feb 2010
Posts: 40

Declare MyString2 character '';

As concatenation will not accept Null values .
Concatenating data types should be unique.
Back to top
View user's profile Send private message
Blomman
PostPosted: Wed May 19, 2010 4:29 am    Post subject: Reply with quote

Master

Joined: 31 Oct 2006
Posts: 230

vmcgloin wrote:
Try using single quotes instead of double quotes e.g. around '.'


Ahh sorry i have single quotes around, just posted it wrong here...
Back to top
View user's profile Send private message
Blomman
PostPosted: Wed May 19, 2010 4:47 am    Post subject: Reply with quote

Master

Joined: 31 Oct 2006
Posts: 230

Svp wrote:
Declare MyString2 character '';

As concatenation will not accept Null values .
Concatenating data types should be unique.


Ahhh so stupid of me of course.....
Just an simple WMB admin not really an developer...

//Blomman
Back to top
View user's profile Send private message
Blomman
PostPosted: Thu May 20, 2010 8:19 am    Post subject: Reply with quote

Master

Joined: 31 Oct 2006
Posts: 230

What about the function TRIM?

If i have an string were i want to trim more then one singleton both TRAILING and LEADING.
In psuedo this is the "Trimming" i want to do the the string:

Code:

var = 'abc abc=abd.'
SET var2 = TRIM(LEADING ' ' var);
SET var2 = TRIM(LEADING '=' var);
SET var2 = TRIM(TRAILING '.' var);


Perhaps trimming whitspace should be like this?
SET var2 = TRIM(LEADING var);

//Blomman
Back to top
View user's profile Send private message
fatherjack
PostPosted: Thu May 20, 2010 9:17 am    Post subject: Reply with quote

Knight

Joined: 14 Apr 2010
Posts: 522
Location: Craggy Island

Blomman wrote:

Code:

var = 'abc abc=abd.'
SET var2 = TRIM(LEADING ' ' var);
SET var2 = TRIM(LEADING '=' var);
SET var2 = TRIM(TRAILING '.' var);

//Blomman


But var doesn't have a leading space or a leading =, so I'm unclear what you're trying to do and what you expect the result of the TRIMs to be.

By default TRIM will remove all leading and trainling spaces e,g,
Code:

SET var2 = TRIM(var);

_________________
Never let the facts get in the way of a good theory.
Back to top
View user's profile Send private message
Blomman
PostPosted: Thu May 20, 2010 10:54 am    Post subject: Reply with quote

Master

Joined: 31 Oct 2006
Posts: 230

fatherjack wrote:
Blomman wrote:

Code:

var = 'abc abc=abd.'
SET var2 = TRIM(LEADING ' ' var);
SET var2 = TRIM(LEADING '=' var);
SET var2 = TRIM(TRAILING '.' var);

//Blomman


But var doesn't have a leading space or a leading =, so I'm unclear what you're trying to do and what you expect the result of the TRIMs to be.

By default TRIM will remove all leading and trainling spaces e,g,
Code:

SET var2 = TRIM(var);



Ok then i missunderstood the TRIM function, i thought it was the first/last occurance of the singleton, not the first/last.

//Blomman
Back to top
View user's profile Send private message
Blomman
PostPosted: Fri May 21, 2010 12:04 am    Post subject: Reply with quote

Master

Joined: 31 Oct 2006
Posts: 230

Ok i havent managed to trim whitepace in an string that isnt leading or trailing.
The string is an FILEDVALUE from InputRoot.MQRFH.usr

I tried something like this...Im not sure if ctrl is the way to go.

Code:

Mystring = '2dfshf734; =483495';
TEST = CAST(X'0d' AS CHARACTER CCSID 819);
  SET Mystring2 = TRANSLATE(Mystring,TEST,'_');
Back to top
View user's profile Send private message
fatherjack
PostPosted: Fri May 21, 2010 12:19 am    Post subject: Reply with quote

Knight

Joined: 14 Apr 2010
Posts: 522
Location: Craggy Island

Blomman wrote:
Ok i havent managed to trim whitepace in an string that isnt leading or trailing.
The string is an FILEDVALUE from InputRoot.MQRFH.usr

I tried something like this...Im not sure if ctrl is the way to go.


Not sure what you're trying to do here. Do you just want to remove all spaces from your string. If so, read about the TRANSLATE function in the documentation.
_________________
Never let the facts get in the way of a good theory.
Back to top
View user's profile Send private message
Blomman
PostPosted: Fri May 21, 2010 1:03 am    Post subject: Reply with quote

Master

Joined: 31 Oct 2006
Posts: 230

fatherjack wrote:
Blomman wrote:
Ok i havent managed to trim whitepace in an string that isnt leading or trailing.
The string is an FILEDVALUE from InputRoot.MQRFH.usr

I tried something like this...Im not sure if ctrl is the way to go.


Not sure what you're trying to do here. Do you just want to remove all spaces from your string. If so, read about the TRANSLATE function in the documentation.


Problem already solved, and yes i used the TRANSLATE function.
Back to top
View user's profile Send private message
Blomman
PostPosted: Wed Jun 16, 2010 2:01 am    Post subject: Reply with quote

Master

Joined: 31 Oct 2006
Posts: 230

Hi again!


Using the same thread for another question.

How to use an UDP as an variable in an function?
Something like this..

Code:

DECLARE myExternal EXTERNAL CHARACTER '';

SET myResult = FIELDVALUE(InputRoot.MQHRF.usr. || myExternal);


Perhaps this may work:

Code:

DECLARE myExternal EXTERNAL CHARACTER '';

SET myResult = FIELDVALUE(InputRoot.MQHRF.usr.{myExternal});


//Blomman
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 » Build string 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.