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 » Query about FileInputNode

Post new topic  Reply to topic
 Query about FileInputNode « View previous topic :: View next topic » 
Author Message
kaushik.godugunur
PostPosted: Wed Jun 05, 2013 4:26 am    Post subject: Query about FileInputNode Reply with quote

Newbie

Joined: 27 Feb 2013
Posts: 9

Hi,

I've a flow which reads a csv file and loads it into a DB. Before the dataload, the DB is flushed of existing data and then the insert happens. We are using the record by record processing with the file input node as my file size is around 8MB with 85000 records currently and is expected to increase. I'm not able to find a way to make sure that the DB flush happens only before the first record is executed and does not happen for subsequent records.

Kindly suggest a way to get this done.

Thanks in advance

Kaushik
Back to top
View user's profile Send private message
lancelotlinc
PostPosted: Wed Jun 05, 2013 4:29 am    Post subject: Reply with quote

Jedi Knight

Joined: 22 Mar 2010
Posts: 4941
Location: Bloomington, IL USA

Store a flag in Environment.Variables tree. Test the flag each record.
_________________
http://leanpub.com/IIB_Tips_and_Tricks
Save $20: Coupon Code: MQSERIES_READER
Back to top
View user's profile Send private message Send e-mail
kaushik.godugunur
PostPosted: Wed Jun 05, 2013 4:35 am    Post subject: Reply with quote

Newbie

Joined: 27 Feb 2013
Posts: 9

Thank you lancelotlinc for the reply!!

But since the control returns to the compute node from FileInputNode after the first record is processed, where im performing the DELETE FROM DATABASE, the flag is being reset everytime a new record is being processed and hence the DELETE.

I hope i understood what you actually meant. Because, as i can see it

SET Environment.Variables.flag = 'TRUE'

IF (Environment.Variables.flag = 'TRUE') THEN
DELETE FROM DB;
SET Environment.Variables.flag = 'FALSE';
END IF;

This above set of statements is executed for every record.

Please let me know if my understanding is wrong!!

Thanks again!!
Back to top
View user's profile Send private message
lancelotlinc
PostPosted: Wed Jun 05, 2013 4:36 am    Post subject: Reply with quote

Jedi Knight

Joined: 22 Mar 2010
Posts: 4941
Location: Bloomington, IL USA

Your on the right track. You might think about using PROPAGATE - RETURN FALSE (in combination with some logic) rather than only RETURN TRUE.

The solution is within your grasp. Keep poking at it until you get it just right.
_________________
http://leanpub.com/IIB_Tips_and_Tricks
Save $20: Coupon Code: MQSERIES_READER
Back to top
View user's profile Send private message Send e-mail
Tech1621
PostPosted: Wed Jun 05, 2013 4:44 am    Post subject: Reply with quote

Novice

Joined: 29 May 2013
Posts: 23

kaushik.godugunur wrote:

This above set of statements is executed for every record.

Please let me know if my understanding is wrong!!

Thanks again!!


What I think from your information provided is after every record processed
add this :
SET Environment.Variables.flag = 'TRUE'

and while flushing the DB use this:

IF (Environment.Variables.flag = 'TRUE') THEN
DELETE FROM DB;
SET Environment.Variables.flag = 'FALSE';
END IF;

I think you also suggested the same..
_________________
Anything is easy if you believe in yourself..
Back to top
View user's profile Send private message
kaushik.godugunur
PostPosted: Wed Jun 05, 2013 4:59 am    Post subject: Reply with quote

Newbie

Joined: 27 Feb 2013
Posts: 9

Hi Tech1621, lacelotlinc,

I apologize by i just don't see it happening.

My requirement is such that when i receive the file with say 100 records and yesterdays file has say, 50 records, I need to delete the 50 existing records and insert the new 100 records. The table does not have any primary key.

Now, I process my file line by line, as in, i set the below mentioned properties in my FileInputNode,

FileInoutNodeProperties -> Records and Elements -> Record detection "Delimited", Delimiter "Custom Delimiter(Hexadecimal)" , Custom delimiter (hexadecimal) "0a", and Delimiter type "Postfix".

Hence for each record of my new 100 record input, my control flows to the following Compute Node where i set the flag as i mentioned before.

So from a logical point of view, setting a flag is not working for me as it is reset everytime and for my current record insertion, the previous record is being deleted.

I was wondering if there is some property which might be able to tell me that the FileInputNode is processing the first record or the second record or so on so that i can add a condition where i check my current record and perform the DELETE.

Kindly correct me if my approach is incorrect or is it just me complicating things here.

Thanks
Kaushik
Back to top
View user's profile Send private message
Vitor
PostPosted: Wed Jun 05, 2013 5:13 am    Post subject: Reply with quote

Grand High Poobah

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

kaushik.godugunur wrote:
I was wondering if there is some property which might be able to tell me that the FileInputNode is processing the first record or the second record or so on so that i can add a condition where i check my current record and perform the DELETE.


Something like the Record property described here?
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
stevarg
PostPosted: Wed Jun 05, 2013 5:29 am    Post subject: Reply with quote

Novice

Joined: 20 Nov 2012
Posts: 24

The timestamp when the file is read is a unique property on which you could decied on clearing the database.
Back to top
View user's profile Send private message
kash3338
PostPosted: Wed Jun 05, 2013 6:58 am    Post subject: Reply with quote

Shaman

Joined: 08 Feb 2009
Posts: 709
Location: Chennai, India

kaushik.godugunur wrote:
I was wondering if there is some property which might be able to tell me that the FileInputNode is processing the first record or the second record or so on so that i can add a condition where i check my current record and perform the DELETE.


stevarg wrote:
The timestamp when the file is read is a unique property on which you could decied on clearing the database.


Agreed! Use this property along with Record property. Save the Timestamp in a EXTERNAL variable and reset it when the Record is 1.
Back to top
View user's profile Send private message Send e-mail
Vitor
PostPosted: Wed Jun 05, 2013 7:01 am    Post subject: Reply with quote

Grand High Poobah

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

kash3338 wrote:
stevarg wrote:
The timestamp when the file is read is a unique property on which you could decied on clearing the database.


Agreed! Use this property along with Record[i] property. Save the [i]Timestamp in a EXTERNAL variable and reset it when the Record is 1.


Why? If the requirement is to flush the db before each and every load, then it's valid to flush it when you read the first record of the new load file, which by definition is a new load. What value does the timestamp give?
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
stevarg
PostPosted: Wed Jun 05, 2013 7:08 am    Post subject: Reply with quote

Novice

Joined: 20 Nov 2012
Posts: 24

The timestamp holds the value when the first record was read...
and it remains the same for each and every record.

A change in timestamp guarantees that its a new file read by the file input node...
Back to top
View user's profile Send private message
kash3338
PostPosted: Wed Jun 05, 2013 7:08 am    Post subject: Reply with quote

Shaman

Joined: 08 Feb 2009
Posts: 709
Location: Chennai, India

Vitor wrote:
Why? If the requirement is to flush the db before each and every load, then it's valid to flush it when you read the first record of the new load file, which by definition is a new load. What value does the timestamp give?


True. I was a bit confused with the timestamp option suggested above. Hence combined both.
Back to top
View user's profile Send private message Send e-mail
reddy2078
PostPosted: Wed Jun 05, 2013 7:10 am    Post subject: @kaushik.godugunur Reply with quote

Newbie

Joined: 21 Apr 2013
Posts: 7

Code:
         IF(InputLocalEnvironment.File.Record = 1) THEN
            DELETE FROM Database.            
         END IF;



hi kaushik
Back to top
View user's profile Send private message Send e-mail
kash3338
PostPosted: Wed Jun 05, 2013 7:10 am    Post subject: Reply with quote

Shaman

Joined: 08 Feb 2009
Posts: 709
Location: Chennai, India

stevarg wrote:
A change in timestamp guarantees that its a new file read by the file input node...


Even the Record value of 1 guarantees that
Back to top
View user's profile Send private message Send e-mail
kaushik.godugunur
PostPosted: Thu Jun 06, 2013 12:34 am    Post subject: Reply with quote

Newbie

Joined: 27 Feb 2013
Posts: 9

Hi,

Thank you everyone!!

IF( InputLocalEnvironment.File.Record = 1) THEN
DELETE FROM Database;
END IF;

This did the job for me.

Apologies, the broker was down the whole of yesterday for maintenance so I could get a confirmation just now.

Thanks and Regards
Kaushik
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 » Query about FileInputNode
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.