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 » STRING Manipulation: Evaluating the leading character.

Post new topic  Reply to topic
 STRING Manipulation: Evaluating the leading character. « View previous topic :: View next topic » 
Author Message
Kool-Aid
PostPosted: Fri May 21, 2004 7:25 am    Post subject: STRING Manipulation: Evaluating the leading character. Reply with quote

Novice

Joined: 22 Apr 2004
Posts: 22

I am trying to code the following rule:

Example
If leading character of FIELD = "H" then set FIELD ='1', else ='0'

Pretty simple stuff. For some reason it is not giving me the output I expect. My code is as follows:

DECLARE LeadingMatnr CHAR;
SET LeadingMatnr=
TRIM(LEADING FROM "InputBody"."BBC.OC.TEST"."BBCTEST.OC"."Field_2");

IF LeadingMatnr = 'L'
THEN
SET "OutputRoot"."XML"."IDOC"."MTART".(XML.Content) = '1';
ELSE
SET "OutputRoot"."XML"."IDOC"."MTART".(XML.Content) = '0';
END IF;

My input data is: ILOVEYOU. The word LOVE is in field_2 and its leading character is "L".

I would expect MTART to equal 1 instead I am getting zero.

Do you know a better way to code this or so I have something syntactically wrong?
Back to top
View user's profile Send private message
JT
PostPosted: Fri May 21, 2004 7:58 am    Post subject: Reply with quote

Padawan

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

Instead of this
Code:
SET LeadingMatnr=TRIM(LEADING FROM "InputBody"."BBC.OC.TEST"."BBCTEST.OC"."Field_2");

Try this:
Code:
SET LeadingMatnr=SUBSTRING("InputBody"."BBC.OC.TEST"."BBCTEST.OC"."Field_2" FROM 1 FOR 1);
Back to top
View user's profile Send private message
Kool-Aid
PostPosted: Fri May 21, 2004 8:50 am    Post subject: THIS ISSUE HAS BEEN RESOLVED. Reply with quote

Novice

Joined: 22 Apr 2004
Posts: 22

Thanks it worked perfect. I am just curious. What is the LEADING used for and when should it be used?
Back to top
View user's profile Send private message
JT
PostPosted: Fri May 21, 2004 9:02 am    Post subject: Reply with quote

Padawan

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

The only time I've used the LEADING parameter was on a TRIM command to remove the leading value that I specified on the TRIM command.. Optionally you can also use the LTRIM & RTRIM commands.
Back to top
View user's profile Send private message
kspranava
PostPosted: Sun May 23, 2004 6:20 pm    Post subject: LEADING Reply with quote

Centurion

Joined: 27 Apr 2003
Posts: 124

Hi KoolAid,

What a LEADING specification in TRIM command does is, it will remove the leading singleton from the input field.

As per the code,
SET LeadingMatnr=
TRIM(LEADING FROM "InputBody"."BBC.OC.TEST"."BBCTEST.OC"."Field_2");

LeadingMatnr will be set to LOVE if "Field_2" has "LOVE" and will not contain L as per your requirement. Since, there is no singleton mentioned it takes the default one 'space'. As expected, command removes the leading spaces, if any and sets the rest to the field.

Pranava.
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 » STRING Manipulation: Evaluating the leading character.
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.