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 » How to get a string lenght of a variable ??

Post new topic  Reply to topic
 How to get a string lenght of a variable ?? « View previous topic :: View next topic » 
Author Message
elvis_gn
PostPosted: Mon Nov 29, 2004 8:51 pm    Post subject: How to get a string lenght of a variable ?? Reply with quote

Padawan

Joined: 08 Oct 2004
Posts: 1905
Location: Dubai

Hi,

I am using a variable,suppose 'A'.
I wanted to know how I can know the string length of the variable.
I actually want to append the variable string to a fixed length.

Example:
If I have 'A' = elvis stored,but I want a fixed length of 10 how can i append '0' to it to make it '00000elvis'. The data in the variable will be different in size depending upon a XML input.
Back to top
View user's profile Send private message Send e-mail
JT
PostPosted: Mon Nov 29, 2004 9:01 pm    Post subject: Reply with quote

Padawan

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

Try something like this (untested):
Code:
SET A = SUBSTRING('0000000000' FROM 1 FOR (10 - LENGTH(A))) || A;
Back to top
View user's profile Send private message
kirani
PostPosted: Mon Nov 29, 2004 11:28 pm    Post subject: Reply with quote

Jedi Knight

Joined: 05 Sep 2001
Posts: 3779
Location: Torrance, CA, USA

If you are modeling your messae using MRM then you can use padding feature to pad your output data with any char. You can also mention whether you want that element value to be left justified or right justified.
_________________
Kiran


IBM Cert. Solution Designer & System Administrator - WBIMB V5
IBM Cert. Solutions Expert - WMQI
IBM Cert. Specialist - WMQI, MQSeries
IBM Cert. Developer - MQSeries

Back to top
View user's profile Send private message Visit poster's website
elvis_gn
PostPosted: Tue Nov 30, 2004 4:06 am    Post subject: Reply with quote

Padawan

Joined: 08 Oct 2004
Posts: 1905
Location: Dubai

Hey thanks a lot,
I used the code in all ways possible and it works.
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » How to get a string lenght of a 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.