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 » Problem with an integer format

Post new topic  Reply to topic
 Problem with an integer format « View previous topic :: View next topic » 
Author Message
artykito
PostPosted: Thu Jun 24, 2010 2:17 am    Post subject: Problem with an integer format Reply with quote

Apprentice

Joined: 24 Jun 2010
Posts: 33

Hi all I'm newbie in WMB, and I don't know if there is a function who allow you to find a character in a string or something like that. I am going to tell you my problem:

I have one field where I'll receive a lot of records with differents format (for this field) like these:
0000123456
0123456789
0000000-12
000-123456

I want to put them in an INTEGER variable (because I need to do a sum), and doing this, leading zeros are removed for 2 first cases, so there is no problem there.

But for the other 2 cases, if I try to put them directly into an INT variable, the flow fails. I think is because it expected the negative sign "-" before all these leading zeros.

I know I could do a function that find the negative sign and cut the string, but I have 2 loop nested and if I do that, I need another nested loop in order to go char per char finding the negative sign.

I tried to do a pattern with a CAST statement but I don't know how the pattern must be exactly and it fails.

I want to know if there is a way to store the negative fields with this format in an INT variable or do you know a function that could find the char "-" in a string? I know REPLACE but I don't want to remove it, because I need to know if the amount is negative or positive.

Thanks in advance for your help!
Back to top
View user's profile Send private message
mqjeff
PostPosted: Thu Jun 24, 2010 2:38 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

You don't want to remove the - sign, you want to trim all of the leading zeros, in all cases. Oddly enough, there's an ESQL function to do just that.

As a side note, whomever is producing those values is really doing the wrong wrong thing.
Back to top
View user's profile Send private message
artykito
PostPosted: Thu Jun 24, 2010 6:32 am    Post subject: Reply with quote

Apprentice

Joined: 24 Jun 2010
Posts: 33

Yes! that's what I need. Thanks!
Back to top
View user's profile Send private message
Gralgrathor
PostPosted: Tue Jun 29, 2010 2:35 am    Post subject: Re: Problem with an integer format Reply with quote

Master

Joined: 23 Jul 2009
Posts: 297

artykito wrote:
I have one field where I'll receive a lot of records with differents format (for this field) like these:
0000123456
0123456789
0000000-12
000-123456


This looks like data that could be defined using a COBOL copybook - assuming the length of the data does not vary per record. If you manage to describe the data in the right way, then all you have to do is read it, and the MRM parser should convert them into proper values.
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 » Problem with an integer format
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.