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 » File validation against File pattern

Post new topic  Reply to topic
 File validation against File pattern « View previous topic :: View next topic » 
Author Message
prasad.gh789
PostPosted: Wed Aug 06, 2014 4:36 am    Post subject: File validation against File pattern Reply with quote

Novice

Joined: 06 Aug 2014
Posts: 20

Hi all Please Help me
My input file is flat file name pattern is like this

Format of filename TSTxxxxxxyyyymmddss (19 characters)
xxxxxx = Identifier of the sender of the Toll Station Table file, originated by a TC (6 characters).
yyyy = Year (4 characters)
mm = Month (2 characters)
dd = Date (2 characters) ss = Sequence within the day (sequential number of 2 characters increased separately for each file per each sender/receiver combination per day beginning with 01)

we get this message from remote FTP and then by using FILTER node we need to validate the file by using file name format

please provide me the ESQL code for this requirement. i am fresher soo i need help. tomorrow is the delivery
thank you
Back to top
View user's profile Send private message
Vitor
PostPosted: Wed Aug 06, 2014 4:41 am    Post subject: Re: File validation against File pattern Reply with quote

Grand High Poobah

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

prasad.gh789 wrote:
please provide me the ESQL code for this requirement.


Where do we send the invoice? Like you, we get paid to write ESQL.

prasad.gh789 wrote:
i am fresher soo i need help.


Yes you do. You should mention that to whoever gave you the requirement.

prasad.gh789 wrote:
tomorrow is the delivery


You should mention that to whoever gave you the requirement as well; something along the line of expecting a fresher with no help to deliver code in 1 business day is a bit optimistic on their part.

You should also mention that any code you do produce actually comes from a bunch of anonymous and unaccountable strangers on the Internet so in the event of problems (or future development) that's going to be problematic, and actually getting the fresher in question some locally based mentoring & realistic deadlines is the way to go.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
Vitor
PostPosted: Wed Aug 06, 2014 4:50 am    Post subject: Re: File validation against File pattern Reply with quote

Grand High Poobah

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

prasad.gh789 wrote:
Format of filename TSTxxxxxxyyyymmddss (19 characters)
xxxxxx = Identifier of the sender of the Toll Station Table file, originated by a TC (6 characters).
yyyy = Year (4 characters)
mm = Month (2 characters)
dd = Date (2 characters) ss = Sequence within the day (sequential number of 2 characters increased separately for each file per each sender/receiver combination per day beginning with 01)


But because it's Wednesday:

Code:

SET cIdentifier=SUBSTRING(InputLocalEnvironment.File.Name FROM 3 FOR 6);
SET dDate=CAST(SUBSTRING(InputLocalEnvironment.File.Name FROM 9 FOR 8) AS DATE FORMAT 'yymmdd');
SET iSequence=CAST(SUBSTRING(InputLocalEnvironment FROM 17 FOR 2) AS INTEGER);

IF iSequence +1 <> iWhateverTheLastSequenceNumberWas THEN
THROW USER EXCEPTION MESSAGE "We're all going to die";
END IF;


You can spend from now until delivery tomorrow finishing that, and fixing the bugs I've quite deliberately put into it which I'd be obliged if no-one else chips in on.

Teach a fresher to fish and all that....
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
smdavies99
PostPosted: Wed Aug 06, 2014 4:56 am    Post subject: Reply with quote

Jedi Council

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

In addition to my colleagues comments,


This bit

Quote:

then by using FILTER node we need to validate the file by using file name format


Sounds like the 'designer' does not know the product very well.
Their thinking may well have been...
We need to filter out some files. :Lightbulb moment, I know, we can use a filter node

to prescribe to a novice the type of node to use for doing this validation is in my mind the sign of a badly formed requirement.

What happens if you can't meet the requirement using a 'filter node'? Can you switch to a more flexible compute node? Or do you fail?

If you have not received proper training in the product AND have experience in setting up File nodes for FTP then there is no way, 1 day is adequate for this task.
_________________
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
Vitor
PostPosted: Wed Aug 06, 2014 5:52 am    Post subject: Reply with quote

Grand High Poobah

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

smdavies99 wrote:
Their thinking may well have been...
We need to filter out some files. :Lightbulb moment, I know, we can use a filter node


Now what's wrong with "filtering" files out by throwing an exception if the name doesn't match? I mean, they go into the backout folder...

1 day for the whole task is optimistic even assuming the concept is sound (hah!) and the person charged with the task has a level of expereince. The OP has been thrown in the deep end after being given an anvil to hold, hence the example code from me of all people (!)
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
smdavies99
PostPosted: Wed Aug 06, 2014 7:40 am    Post subject: Reply with quote

Jedi Council

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

Vitor wrote:
smdavies99 wrote:
Their thinking may well have been...
We need to filter out some files. :Lightbulb moment, I know, we can use a filter node


Now what's wrong with "filtering" files out by throwing an exception if the name doesn't match? I mean, they go into the backout folder...

1 day for the whole task is optimistic even assuming the concept is sound (hah!) and the person charged with the task has a level of expereince. The OP has been thrown in the deep end after being given an anvil to hold, hence the example code from me of all people (!)


nothing wrong with that but it sometimes takes a while to understand the subtle differences between the message tree used in a Filter Node and a Compute Node. I've not looked at your code in details so I don't want to say any more.
_________________
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
McueMart
PostPosted: Wed Aug 06, 2014 8:09 am    Post subject: Reply with quote

Chevalier

Joined: 29 Nov 2011
Posts: 490
Location: UK...somewhere

Code:

SET cIdentifier=SUBSTRING(InputLocalEnvironment.File.Name FROM 3 FOR 6);
SET dDate=CAST(SUBSTRING(InputLocalEnvironment.File.Name FROM 9 FOR 8) AS DATE FORMAT 'yymmdd');  -- 3 mistakes (that's just mean)
SET iSequence=CAST(SUBSTRING(InputLocalEnvironment FROM 17 FOR 2) AS INTEGER); -- 1 mistake

IF iSequence +1 <> iWhateverTheLastSequenceNumberWas THEN -- 1 mistake
THROW USER EXCEPTION MESSAGE "We're all going to die";
END IF;


Back to top
View user's profile Send private message
paustin_ours
PostPosted: Wed Aug 06, 2014 9:15 am    Post subject: Reply with quote

Yatiri

Joined: 19 May 2004
Posts: 667
Location: columbus,oh

Quote:
please provide me the ESQL code for this requirement. i am fresher soo i need help. tomorrow is the delivery


good example of modern day slavery. The so called IT outsourcing giants exploiting people.
Back to top
View user's profile Send private message Yahoo Messenger
Vitor
PostPosted: Wed Aug 06, 2014 9:24 am    Post subject: Reply with quote

Grand High Poobah

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

McueMart wrote:
Code:

SET cIdentifier=SUBSTRING(InputLocalEnvironment.File.Name FROM 3 FOR 6);
SET dDate=CAST(SUBSTRING(InputLocalEnvironment.File.Name FROM 9 FOR 8) AS DATE FORMAT 'yymmdd');  -- 3 mistakes (that's just mean)
SET iSequence=CAST(SUBSTRING(InputLocalEnvironment FROM 17 FOR 2) AS INTEGER); -- 1 mistake

IF iSequence +1 <> iWhateverTheLastSequenceNumberWas THEN -- 1 mistake
THROW USER EXCEPTION MESSAGE "We're all going to die";
END IF;


I didn't have to offer any code, and under other circumstances I wouldn't.

And you missed a couple.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
prasad.gh789
PostPosted: Tue Aug 12, 2014 11:21 pm    Post subject: Reply with quote

Novice

Joined: 06 Aug 2014
Posts: 20

Thank you soooo much for all your support.
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 » File validation against File pattern
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.