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 » Pad string with leading zeros

Post new topic  Reply to topic
 Pad string with leading zeros « View previous topic :: View next topic » 
Author Message
CHERIANV
PostPosted: Wed Feb 12, 2003 7:08 pm    Post subject: Pad string with leading zeros Reply with quote

Apprentice

Joined: 15 Feb 2002
Posts: 43
Location: New York

Hi,
In ESQL , what is the most efficient way to pad a string that is an input MRM field with leading zeros.
Back to top
View user's profile Send private message
lillo
PostPosted: Wed Feb 12, 2003 11:46 pm    Post subject: Reply with quote

Master

Joined: 11 Sep 2001
Posts: 224

Try the following:
Code:
SET OutputRoot.MRM.FIELD = LTRIM('0' FROM InputRoot.MRM.FIELD);


Cheers,
_________________
Lillo
IBM Certified Specialist - WebSphere MQ
Back to top
View user's profile Send private message
jfluitsm
PostPosted: Thu Feb 13, 2003 12:51 am    Post subject: Reply with quote

Disciple

Joined: 24 Feb 2002
Posts: 160
Location: The Netherlands

You can fill the padding character in the cwf-layer of this field (under Types).
pre-2.1 using '0' didn't work but x'30' (Unicode for zero) did.
In this way removing (input) and adding (output) the padding character(s) is done by the MRM.
_________________
Jan Fluitsma

IBM Certified Solution Designer WebSphere MQ V6
IBM Certified Solution Developer WebSphere Message Broker V6
Back to top
View user's profile Send private message Send e-mail
jas
PostPosted: Thu Feb 13, 2003 1:03 am    Post subject: Reply with quote

Novice

Joined: 28 Jul 2002
Posts: 12

we used the following code when converting from XML (unknown length) to MRM (fixed length)

SET CharLen = LENGTH(InputRoot.XML.FIELD);

SET OutputRoot.MRM.FIELD =
SUBSTRING('000000000000000' || InputRoot.XML.FIELD FROM CharLen FOR LENGTH)


where number of zeroes is according to length of output MRM field
Back to top
View user's profile Send private message
jfluitsm
PostPosted: Thu Feb 13, 2003 1:42 am    Post subject: Reply with quote

Disciple

Joined: 24 Feb 2002
Posts: 160
Location: The Netherlands

We did the same until we discovered that justify right and padding with x'30' or '0' did the trick for us, saved a lot of coding and for all you don't need to know the length of MRM.FIELD.
Only difference is when XML.FIELD is longer than MRM.FIELD, with your method the value is truncated, when using the MRM for padding you will get an error (field too long).
_________________
Jan Fluitsma

IBM Certified Solution Designer WebSphere MQ V6
IBM Certified Solution Developer WebSphere Message Broker V6
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 » Pad string with leading zeros
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.