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 » How can I ignore 1st record in a file

Post new topic  Reply to topic Goto page 1, 2  Next
 How can I ignore 1st record in a file « View previous topic :: View next topic » 
Author Message
Radhikab
PostPosted: Wed Nov 16, 2011 9:50 pm    Post subject: How can I ignore 1st record in a file Reply with quote

Novice

Joined: 16 Nov 2011
Posts: 11

Hi,
We will be receiving a standard format from each source in the form of semi-colon delimited CSV files and we have to convert it to XML message by taking each single record ina file.

Each record on the file contains 10 fields. The first 10 fields of data will always contain a header that describes each field, so this first line should be ignored and no trade created from it.

Iam using while loop

DECLARE IN_I INTEGER 2;
SET IN_RECORD_COUNT = CARDINALITY ( "InputBody"."Record"[] ) ;
WHILE ( IN_I <= IN_RECORD_COUNT ) DO
SET A= TRIM('"' FROM TRIM("InputBody"."Record"[IN_I]."A"));
SET B= TRIM('"' FROM TRIM("InputBody"."Record"[IN_I]."B"));
SET C= TRIM('"' FROM TRIM("InputBody"."Record"[IN_I]."C"));
SET D= TRIM('"' FROM TRIM("InputBody"."Record"[IN_I]."D"));
SET E= TRIM('"' FROM TRIM("InputBody"."Record"[IN_I]."E"));
SET F= TRIM('"' FROM TRIM("InputBody"."Record"[IN_I]."F"));
SET G= TRIM('"' FROM TRIM("InputBody"."Record"[IN_I]."G"));
SET H= TRIM('"' FROM TRIM("InputBody"."Record"[IN_I]."H"));
SET I= TRIM('"' FROM TRIM("InputBody"."Record"[IN_I]."I"));
SET J= TRIM('"' FROM TRIM("InputBody"."Record"[IN_I]."J"));

CALL INBOUND();
set IN_I = IN_I+1;
END WHILE;

Can anyone of you let me know how to ignore 1st record?

Thanks in advance
Back to top
View user's profile Send private message
saurabh867
PostPosted: Wed Nov 16, 2011 11:54 pm    Post subject: Reply with quote

Voyager

Joined: 13 Jun 2010
Posts: 78

Hi,
Is not working with your solution ?

Another way could be to handle this in your message set. Specify one more complex type (e.g. Header with occurrence set to 1) before your Record complex type.

Now you can always look at only the Record and need not bother about Header but if you want to refer, you can use that in future.


Regards,
Saurabh
Back to top
View user's profile Send private message
zpat
PostPosted: Thu Nov 17, 2011 12:19 am    Post subject: Reply with quote

Jedi Council

Joined: 19 May 2001
Posts: 5866
Location: UK

Why not process the file record by record in the file input node, setting the record delimiter to ";"?

Then just ignore the first record, by setting a flag in the environment data to check.

Always remember, files equate to queues, records equate to messages.

Processing a whole file at once will create file size restrictions, and may result in too many uncommitted MQ messages and so on. Avoid.
Back to top
View user's profile Send private message
Radhikab
PostPosted: Thu Nov 17, 2011 12:50 am    Post subject: Reply with quote

Novice

Joined: 16 Nov 2011
Posts: 11

Hi Saurabh,

Thanks for the response
no, my code is not working..
Also,I tried creating one more complextype as header with min and max occurs as '1' and declared all 10 fields in it. Still it is processing message for 1st row.

don't knw where I did a mistake.
Back to top
View user's profile Send private message
Radhikab
PostPosted: Thu Nov 17, 2011 12:57 am    Post subject: Reply with quote

Novice

Joined: 16 Nov 2011
Posts: 11

Hi,

I was instructed to use mqinput node instead of fileinput node.
Back to top
View user's profile Send private message
kimbert
PostPosted: Thu Nov 17, 2011 1:12 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

Quote:
Another way could be to handle this in your message set. Specify one more complex type (e.g. Header with occurrence set to 1) before your Record complex type.
This is the easiest solution. If it is not working, put a Trace node after the input node so that you can see the message tree. Then take a debug-level user trace, so that you can see exactly what the parser did.
Quote:
don't knw where I did a mistake.
Tell us what happened. We may be able to suggest something.

<plug>In WMB v8 this scenario it will be much easier to create and debug CSV scenarios using the DFDL parser.</plug>
Back to top
View user's profile Send private message
Radhikab
PostPosted: Thu Nov 17, 2011 1:32 am    Post subject: Reply with quote

Novice

Joined: 16 Nov 2011
Posts: 11

Created message set with header and record. min occurs and max occurs is 1 for header and for records it is 0 to -1.

and in my esql code am using the code which was posted in my question.

message flow:

mqinputnode--->computenode---> computenode---> mqoutputnode
Back to top
View user's profile Send private message
kimbert
PostPosted: Thu Nov 17, 2011 1:38 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

Good. But what is the problem? What is happening that should not?
Back to top
View user's profile Send private message
Radhikab
PostPosted: Thu Nov 17, 2011 1:42 am    Post subject: Reply with quote

Novice

Joined: 16 Nov 2011
Posts: 11

as per the requirement it has to ignore 1st record. but it is creating message for header also.

We don't have debugger to trace the message. we are using wmb 6.1
Back to top
View user's profile Send private message
ajit1981
PostPosted: Thu Nov 17, 2011 1:52 am    Post subject: Reply with quote

Apprentice

Joined: 09 Apr 2010
Posts: 41
Location: Bangalore, Inida

I rembered once we got this requirement. Since our 1st records was fixed message . So we put If statment to check that fixed message and ignored that records.
_________________
Regards,
Ajit
Back to top
View user's profile Send private message
Radhikab
PostPosted: Thu Nov 17, 2011 2:01 am    Post subject: Reply with quote

Novice

Joined: 16 Nov 2011
Posts: 11

Hi Ajit,

I tried like this
IF IN_I > 1 then
CALL INBOUND();
end if;
set IN_I = IN_I+1;

Then also it is creating message for 1st record
Back to top
View user's profile Send private message
kimbert
PostPosted: Thu Nov 17, 2011 2:12 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

Quote:
Then also it is creating message for 1st record
User trace.
Back to top
View user's profile Send private message
Radhikab
PostPosted: Thu Nov 17, 2011 2:30 am    Post subject: Reply with quote

Novice

Joined: 16 Nov 2011
Posts: 11

Hi Kimbert,

Can you please check my code and let me know whether it is correct?


Last edited by Radhikab on Thu Nov 17, 2011 2:32 am; edited 1 time in total
Back to top
View user's profile Send private message
ajit1981
PostPosted: Thu Nov 17, 2011 2:31 am    Post subject: Reply with quote

Apprentice

Joined: 09 Apr 2010
Posts: 41
Location: Bangalore, Inida

If your 1 records is fixed. Example. AccountNo,Name,Amount,Date

and you are using messageset , then write If conditon to remove first records.
IF inputroot.......ACC.NO = 'AccountNo' AND inputroot.......NAME = 'Name' AND inputroot.......AMOUNT = 'Amount' AND inputroot.......DATE = 'Date'
--do nothing
ELSE
write your code here
ENdIF;

Assuming ACC.NO,NAME,AMOUNT,DATE is element name in Messageset.
_________________
Regards,
Ajit
Back to top
View user's profile Send private message
Radhikab
PostPosted: Thu Nov 17, 2011 2:53 am    Post subject: Reply with quote

Novice

Joined: 16 Nov 2011
Posts: 11

Hi Amit,

Thanks for suggestion.. Could you please paste the complete code?
Iam using SET A= TRIM('"' FROM TRIM("InputBody"."Record"[IN_I]."A"));
SET B= TRIM('"' FROM TRIM("InputBody"."Record"[IN_I]."B"));
SET C= TRIM('"' FROM TRIM("InputBody"."Record"[IN_I]."C"));
SET D= TRIM('"' FROM TRIM("InputBody"."Record"[IN_I]."D"));
SET E= TRIM('"' FROM TRIM("InputBody"."Record"[IN_I]."E"));
SET F= TRIM('"' FROM TRIM("InputBody"."Record"[IN_I]."F"));
SET G= TRIM('"' FROM TRIM("InputBody"."Record"[IN_I]."G"));
SET H= TRIM('"' FROM TRIM("InputBody"."Record"[IN_I]."H"));
SET I= TRIM('"' FROM TRIM("InputBody"."Record"[IN_I]."I"));
SET J= TRIM('"' FROM TRIM("InputBody"."Record"[IN_I]."J"));
and in INbound procedure am using A,B,C,D.... for creating xml message..

SET OutputRoot.XML.InboundGTMXML.TradeDetails.Currency= A ;
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 » How can I ignore 1st record in a file
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.