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 the numeric values with out exception

Post new topic  This topic is locked: you cannot edit posts or make replies.
 validate the numeric values with out exception « View previous topic :: View next topic » 
Author Message
prasad.gh789
PostPosted: Mon Sep 08, 2014 10:07 pm    Post subject: validate the numeric values with out exception Reply with quote

Novice

Joined: 06 Aug 2014
Posts: 20

Input filename:-
Pic100007_P012_L03_F0_XEX_D2000_03_10_T23_10_14_N00000024.jpg

we need validate above file name here is one logic

Followed by 'D'
- Followed by 4 digits
- Followed by '_'
- Followed by 2 digits
- Followed by '_'
- Followed by 2 digits
- Followed by '_'
- Followed by 'T'
- Followed by 2 digits
- Followed by '_'
- Followed by 2 digits
- Followed by '_'
- Followed by 2 digits
- Followed by '_'
- Followed by 'N'
- Followed by 8 digits

here these are date fallowed by tim_stamp and 8-digit sequence number soo we need to validate these values as integers. i developed esql for this logic pls find below

DECLARE eigt_two, date_year, date_mm, date_dd, time_hh, time_mm, time_ss, serial_num INTEGER;
DECLARE date_yearLEN,date_mmLEN,date_ddLEN,time_hhLEN,time_mmLEN,time_ssLEN,serial_numLEN INTEGER 0;

SET date_year = SUBSTRING(RSGfile_name FROM 28 FOR 4);
SET date_yearLEN = LENGTH(TRANSLATE(date_year,'0123456789',''));

SET date_mm = SUBSTRING(RSGfile_name FROM 33 FOR 2);
SET date_mmLEN=LENGTH(TRANSLATE(date_mm,'0123456789',''));

SET date_dd = SUBSTRING(RSGfile_name FROM 36 FOR 2);
SET date_ddLEN=LENGTH(TRANSLATE(date_dd,'0123456789',''));

SET time_hh = SUBSTRING(RSGfile_name FROM 40 FOR 2);
SET time_hhLEN=LENGTH(TRANSLATE(time_hh,'0123456789',''));

SET time_mm = SUBSTRING(RSGfile_name FROM 43 FOR 2);
SET time_mmLEN=LENGTH(TRANSLATE(time_mm,'0123456789',''));

SET time_ss = SUBSTRING(RSGfile_name FROM 46 FOR 2);
SET time_ssLEN=LENGTH(TRANSLATE(time_ss,'0123456789',''));

SET serial_num = SUBSTRING(RSGfile_name FROM 50 FOR ;
SET serial_numLEN=LENGTH(TRANSLATE(serial_num,'0123456789',''));

By using simply SET =INTEGER also we can validate this but we got exception while giving the false file name as input(if we get another datatype values in place of integers). that is not good

to overcome that we can use this TRANSLATE function to validate the integers with out exception throwing while giving the wrong file name

This code is working fine. but lengthy let me know simple esql logic
to reduce the lines of code.
Back to top
View user's profile Send private message
smdavies99
PostPosted: Mon Sep 08, 2014 11:07 pm    Post subject: Reply with quote

Jedi Council

Joined: 10 Feb 2003
Posts: 6076
Location: Somewhere over the Rainbow this side of Never-never land.

You could create a DFDL model of the field, treating it as if it were a message with the '_' as a delimiter character. Then you can parse it and validate it all in one go.
_________________
WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995

Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions.
Back to top
View user's profile Send private message
prasad.gh789
PostPosted: Tue Sep 09, 2014 3:07 am    Post subject: Reply with quote

Novice

Joined: 06 Aug 2014
Posts: 20

pls try to understand my exact requirement
Back to top
View user's profile Send private message
kimbert
PostPosted: Tue Sep 09, 2014 3:52 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

I would do it using a regular expression.
ESQL does not have support for regular expressions, but Java does. You could do the job in a couple of lines in a JavaCompute node.
_________________
Before you criticize someone, walk a mile in their shoes. That way you're a mile away, and you have their shoes too.
Back to top
View user's profile Send private message
Vitor
PostPosted: Tue Sep 09, 2014 4:32 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

prasad.gh789 wrote:
pls try to understand my exact requirement


Pls try to understand asking the same question 3 different ways doesn't yield very different answers and is considered rude!
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  This topic is locked: you cannot edit posts or make replies. Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » validate the numeric values with out exception
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.