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 » Validate integer and decimals

Post new topic  Reply to topic Goto page 1, 2  Next
 Validate integer and decimals « View previous topic :: View next topic » 
Author Message
broker_new
PostPosted: Sat Mar 14, 2009 2:25 pm    Post subject: Validate integer and decimals Reply with quote

Yatiri

Joined: 30 Nov 2006
Posts: 614
Location: Washington DC

Wondering is there an ESQL command to check for a field as integer or decimal. I have tried IS INTEGER but didn't worked.
_________________
IBM ->Let's build a smarter planet
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Sat Mar 14, 2009 3:31 pm    Post subject: Re: Validate integer and decimals Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

broker_new wrote:
Wondering is there an ESQL command to check for a field as integer or decimal. I have tried IS INTEGER but didn't worked.

Did you compare types?
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
kimbert
PostPosted: Sun Mar 15, 2009 1:51 pm    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

http://publib.boulder.ibm.com/infocenter/wmbhelp/v6r1m0/topic/com.ibm.etools.mft.doc/ak01045_.htm
Back to top
View user's profile Send private message
broker_new
PostPosted: Sun Mar 15, 2009 4:06 pm    Post subject: Reply with quote

Yatiri

Joined: 30 Nov 2006
Posts: 614
Location: Washington DC

DECLARE intDataTye CHARACTER FIELDTYPE(InputRoot.XMLNS.In.Int);
DECLARE strDataTye CHARACTER FIELDTYPE(InputRoot.XMLNS.In.Str);
DECLARE decDataTye CHARACTER FIELDTYPE(InputRoot.XMLNS.In.Dec);

returns 16777216 for all three statements but not INTEGER,CHAR,DECIMAL...

is FIELDTYPE is the correct statement to use?
_________________
IBM ->Let's build a smarter planet
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Sun Mar 15, 2009 8:09 pm    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

broker_new wrote:
DECLARE intDataTye CHARACTER FIELDTYPE(InputRoot.XMLNS.In.Int);
DECLARE strDataTye CHARACTER FIELDTYPE(InputRoot.XMLNS.In.Str);
DECLARE decDataTye CHARACTER FIELDTYPE(InputRoot.XMLNS.In.Dec);

returns 16777216 for all three statements but not INTEGER,CHAR,DECIMAL...

is FIELDTYPE is the correct statement to use?

Not quite the way you are doing it.
Can you assign the value of the field to a declared variable of the right type?
If the assignment fails how do you test for that? Hint it will probably look a little bit like when you assign a null value to an INTEGER declared variable....

Enjoy
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
kimbert
PostPosted: Mon Mar 16, 2009 1:43 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

Please explain why you used FIELDTYPE.
Back to top
View user's profile Send private message
HOMETOWN47
PostPosted: Mon Mar 16, 2009 3:26 am    Post subject: Reply with quote

Apprentice

Joined: 25 Mar 2003
Posts: 34

Could you use the CAST function and either set a DEFAULT value to indicate an invalid CAST or declare an exception handler to capture the error (have a look at the CAST help in infocenter)....
Back to top
View user's profile Send private message
broker_new
PostPosted: Mon Mar 16, 2009 5:08 am    Post subject: Reply with quote

Yatiri

Joined: 30 Nov 2006
Posts: 614
Location: Washington DC

Quote:
Can you assign the value of the field to a declared variable of the right type?
If the assignment fails how do you test for that? Hint it will probably look a little bit like when you assign a null value to an INTEGER declared variable....



I realized that there is not a direct function to handle this, i will do it using Java Compute Node. Thanks for your help guys
_________________
IBM ->Let's build a smarter planet
Back to top
View user's profile Send private message
WMBDEV1
PostPosted: Wed Mar 18, 2009 3:32 am    Post subject: Reply with quote

Sentinel

Joined: 05 Mar 2009
Posts: 888
Location: UK

The Java compute node seems like overkill! The previous solution of doing CAST (and handle the resulting error if there is one) sounds more appropriate!
Back to top
View user's profile Send private message
broker_new
PostPosted: Wed Mar 18, 2009 4:43 am    Post subject: Reply with quote

Yatiri

Joined: 30 Nov 2006
Posts: 614
Location: Washington DC

I agree with you.Thanks for posting.Definitely we can do it, when we told we have to cast our team didn't accept and thought we are making the problem.
and between us.....If we are doing a cast for field type validations for fields over 200 and do you think is this worth of doing it.

The web methods team took over the things from us and they are performing the validations e.t.c.
_________________
IBM ->Let's build a smarter planet
Back to top
View user's profile Send private message
mgk
PostPosted: Wed Mar 18, 2009 8:34 am    Post subject: Reply with quote

Padawan

Joined: 31 Jul 2003
Posts: 1642

Hello,

Can you explain why you want to see if a field is an integer or decimal etc?
_________________
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
View user's profile Send private message
broker_new
PostPosted: Wed Mar 18, 2009 9:27 am    Post subject: Reply with quote

Yatiri

Joined: 30 Nov 2006
Posts: 614
Location: Washington DC

We are calling a web service (on Mainframe) from broker for which we are using XMLNS domain. The web service is acting crazy and sending incorrect data.

I think you will recommend me to use MRM for validatingthis, but i would like to validate the data using ESQL... please.
_________________
IBM ->Let's build a smarter planet
Back to top
View user's profile Send private message
mgk
PostPosted: Wed Mar 18, 2009 10:18 am    Post subject: Reply with quote

Padawan

Joined: 31 Jul 2003
Posts: 1642

Well you can use XMLNSC to validate against an xmlschema in 6.1. Also, do not forget that on the wire all XML is just characters... Do you have an example of the data being sent to and from the webservice along with the actual error message?
_________________
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
View user's profile Send private message
broker_new
PostPosted: Wed Mar 18, 2009 11:25 am    Post subject: Reply with quote

Yatiri

Joined: 30 Nov 2006
Posts: 614
Location: Washington DC

though Its a good feature I would like to achieve the following.
When we do a schema level validation broker will throw an exception list which makes sense to us but not to others.

So what i would like to do is check for the datatypes and create a SOAP response and send it to the client( user defined customized error).

like
(Just an example)..

<SOAPFault>
<FaultMessage> XML Validate errors occured: Invalid data occured passed in this element</FaultMessage>
<SOAPFault>

If we use MRM or schema level validations or CAST then we might not get this clear meaningful errors we get only the exceptionlist.

you might ask me to navigate thru the list....i did but it will not be that descriptive like the example does.
_________________
IBM ->Let's build a smarter planet
Back to top
View user's profile Send private message
kimbert
PostPosted: Wed Mar 18, 2009 3:23 pm    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

How about this:
- Use XMLNSC to parse and validate your XML
- Report all validation errors to the caller in a SOAP fault, and...
- ...detect validation errors which are related to simple type validation, and replace them with a clearer, more meaningful error message.

The advantages of this approach are:
1. You don't have to write the validation code.
2. You get fast, standards-compliant schema validation for free

If the web service has a track record of sending wrong data, you really should be using validation. Next month they might start missing out a tag, or getting a namespace wrong.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Goto page 1, 2  Next Page 1 of 2

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Validate integer and decimals
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.