Author |
Message
|
RAJASHEKAR REDDY |
Posted: Thu Aug 15, 2013 11:13 pm Post subject: Convert lowercase words to Uppercase in middle of the String |
|
|
Novice
Joined: 09 May 2013 Posts: 13
|
Hi Folks,
i have an example string like
NAME=Raja&UserId=shekar&PSWD=1111&Village=abbd&DIST=pqrs&STATE=dfhfh&sex=male
So i want convet Lowercase Parametrs(UserId,Village,sex) to UPPER CASE with in ESQL.
Could you please suggest on this.
Thanks,
RajaShekar Reddy  |
|
Back to top |
|
 |
kimbert |
Posted: Fri Aug 16, 2013 12:21 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Why do you need to do this?
Are you using a parser ( MRM or DFDL ) to create a message tree from the string? _________________ Before you criticize someone, walk a mile in their shoes. That way you're a mile away, and you have their shoes too. |
|
Back to top |
|
 |
RAJASHEKAR REDDY |
Posted: Fri Aug 16, 2013 12:41 am Post subject: |
|
|
Novice
Joined: 09 May 2013 Posts: 13
|
No, i need to caluclate SHA, i want Upper case Parameters |
|
Back to top |
|
 |
kimbert |
Posted: Fri Aug 16, 2013 1:25 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
How are you extracting the data fields from the formatted string? _________________ Before you criticize someone, walk a mile in their shoes. That way you're a mile away, and you have their shoes too. |
|
Back to top |
|
 |
RAJASHEKAR REDDY |
Posted: Fri Aug 16, 2013 2:02 am Post subject: |
|
|
Novice
Joined: 09 May 2013 Posts: 13
|
it's comming as string in single line from external system as above mentioned string. so i need to change parametters as UPPER case. |
|
Back to top |
|
 |
kimbert |
Posted: Fri Aug 16, 2013 2:55 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Quote: |
it's comming as string in single line from external system as above mentioned string. so i need to change parametters as UPPER case. |
Yes, I know. You told us that before.
But how are you extracting the data fields from the formatted string?
Using customer ESQL? Or using a message set? _________________ Before you criticize someone, walk a mile in their shoes. That way you're a mile away, and you have their shoes too. |
|
Back to top |
|
 |
dogorsy |
Posted: Fri Aug 16, 2013 3:07 am Post subject: |
|
|
Knight
Joined: 13 Mar 2013 Posts: 553 Location: Home Office
|
Write an ESQL function to which you pass as parameters the input string and the parameter you want converted to uppercase + the = sign,for example : UserId= or Village=
use index to find the start of the keyword in the string, then add the length of the keyword to calculate the start of the word you want to uppercase. Then look for the & sign or end of string to calculate the end of the word.
once you have start and end of the word, use uppercase.
You can then call the function once for each keyword. If you want to do it all in one go, instead of passing a single parameter, you can build a row in the Environment tree containing all the keywords , and pass a REFERENCE to the function. If you know the keywords are always in the same order, you can build your tree in that order, and the search of the next keyword in the string can start where you finished with the previous one ( supposing you found one ). But it is up to you to work out the logic.
Last edited by dogorsy on Fri Aug 16, 2013 3:15 am; edited 1 time in total |
|
Back to top |
|
 |
lancelotlinc |
Posted: Fri Aug 16, 2013 3:12 am Post subject: |
|
|
 Jedi Knight
Joined: 22 Mar 2010 Posts: 4941 Location: Bloomington, IL USA
|
While it is possible to do this in ESQL as kimbert and dogorsy have mentioned, this might be a use case where a JCN is more appropriate. Hopefully, your manager has not told you that you are prohibited from using Java Compute Nodes (JCNs)... _________________ http://leanpub.com/IIB_Tips_and_Tricks
Save $20: Coupon Code: MQSERIES_READER |
|
Back to top |
|
 |
RAJASHEKAR REDDY |
Posted: Fri Aug 16, 2013 3:18 am Post subject: |
|
|
Novice
Joined: 09 May 2013 Posts: 13
|
Thanks to all,
i need write in ESQL and i have many Parameters.
And no need to extacting , i want send as same string but parametters should be UPPER CASE
Thanks  |
|
Back to top |
|
 |
mgk |
Posted: Fri Aug 16, 2013 4:11 am Post subject: |
|
|
 Padawan
Joined: 31 Jul 2003 Posts: 1642
|
Out of interest is this string arriving as a "query-string" from an HTTPInput node? _________________ 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 |
|
 |
NealM |
Posted: Fri Aug 16, 2013 4:58 am Post subject: |
|
|
 Master
Joined: 22 Feb 2011 Posts: 230 Location: NC or Utah (depends)
|
Use a FOR loop, inside it use POSITION to find your first '&', use another POSITION to find your first '=' after your &, apply UPPER to the chars between them, then move past that before repeating your loop. End the loop when POSITION returns a zero.
Play with it, it won't take you long to get it working. |
|
Back to top |
|
 |
smdavies99 |
Posted: Fri Aug 16, 2013 5:59 am Post subject: |
|
|
 Jedi Council
Joined: 10 Feb 2003 Posts: 6076 Location: Somewhere over the Rainbow this side of Never-never land.
|
mgk wrote: |
Out of interest is this string arriving as a "query-string" from an HTTPInput node? |
That is an interesting thought.
In these cases I use a common procedure to extract each param in the request. It is not difficult to extract each bit.
You could even do it in a loop where the extract returns the next param and loops until nothing is returned. Then you can use a CASE structure to selectively convert those required to UPPERCASE.
Not that difficult if you put your mind to it. _________________ WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995
Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions. |
|
Back to top |
|
 |
mgk |
Posted: Fri Aug 16, 2013 6:32 am Post subject: |
|
|
 Padawan
Joined: 31 Jul 2003 Posts: 1642
|
Quote: |
That is an interesting thought. |
My thought was that if it was a query-string then there is an option on the HTTPInput node which it will split the string into name-value pairs and place them in the LocalEnvironment for you, so no coding required at all
Kind regards, _________________ 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 |
|
 |
lancelotlinc |
Posted: Fri Aug 16, 2013 6:33 am Post subject: |
|
|
 Jedi Knight
Joined: 22 Mar 2010 Posts: 4941 Location: Bloomington, IL USA
|
mgk wrote: |
Quote: |
That is an interesting thought. |
My thought was that if it was a query-string then there is an option on the HTTPInput node which it will split the string into name-value pairs and place them in the LocalEnvironment for you, so no coding required at all , |
Oooo - aaaaah ! A new feature ! _________________ http://leanpub.com/IIB_Tips_and_Tricks
Save $20: Coupon Code: MQSERIES_READER |
|
Back to top |
|
 |
mgk |
Posted: Fri Aug 16, 2013 6:40 am Post subject: |
|
|
 Padawan
Joined: 31 Jul 2003 Posts: 1642
|
Quote: |
Oooo - aaaaah ! A new feature ! |
Well, it was new once, back in 6.1.0.4, when "the Parse Query String" option was introduced
Kind regards, _________________ 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 |
|
 |
|