Author |
Message
|
chenna.hari |
Posted: Sun Mar 22, 2009 4:04 am Post subject: Pipe Delimited file format with multiple records |
|
|
Centurion
Joined: 21 Mar 2009 Posts: 103
|
Hi,
I have file format like this
a|b|c|d|e|f
a|b|c|d|e|f
..............
..............
..............
a|b|c|d|e|f
here values of a, b, c, d, e, f are any values i.e. different for different records.
And i need to separate the records based on the 'b' value.
like if 'b' value is less than 5, then need to send those records in one file and remaining records to other file.
like for example.
a|5|c|d|e|f
a|4|c|d|e|f
a|6|c|d|e|f
a|3|c|d|e|f
then the records
a|4|c|d|e|f
a|3|c|d|e|f
are need to send to one file
and the records
a|5|c|d|e|f
a|6|c|d|e|f are need to send to another file.
here MRM msgset is like this
Record
element1
element2
and ofcourse record will be repeative.
Here i need to store records for one condition in Environment variables so that i will assign this back to outputRoot and propagate.
can any one help how to store InputRoot.MRM.Record to Environment variables and assign back to OutputRoot.MRM. |
|
Back to top |
|
 |
smdavies99 |
Posted: Sun Mar 22, 2009 4:42 am Post subject: |
|
|
 Jedi Council
Joined: 10 Feb 2003 Posts: 6076 Location: Somewhere over the Rainbow this side of Never-never land.
|
What options/methods have you tried? (eg code)
Have you searched this Forum for simiar questions?
Have you read the product Documentation?
etc
We really want to help you help yourself. That way you will learn quicker. _________________ 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 |
|
 |
chenna.hari |
Posted: Sun Mar 22, 2009 7:25 pm Post subject: |
|
|
Centurion
Joined: 21 Mar 2009 Posts: 103
|
smdavies99 wrote: |
What options/methods have you tried? (eg code)
Have you searched this Forum for simiar questions?
Have you read the product Documentation?
etc
We really want to help you help yourself. That way you will learn quicker. |
I tried with example code like this
While
SET Environment.Variables.MRM.Record[RecordCount1].Element1 = InputRoot.MRM.Record[RecordCount].Element1;
--
---
END
and assigning back to OuputRoot like this.
DECLARE parseOptions INTEGER BITOR(FolderBitStream, ValidateContent, ValidateValue, ValidateLocalError);
DECLARE subBitStream BLOB
CAST(ASBITSTREAM(Environment.Variables.MRM.Record
OPTIONS parseOptions
SET 'MST'
TYPE 'CSV_Message/Record'
FORMAT 'Text1') AS BLOB);
IF subBitStream IS NOT NULL THEN
CREATE LASTCHILD OF OutputRoot.MRM
PARSE ( subBitStream
OPTIONS parseOptions
SET 'MST'
TYPE 'CSV_Message/Record'
FORMAT 'Text1');
END IF;
but iam not getting records in Output
Pls let me know whether process is correct or any wrong in this code |
|
Back to top |
|
 |
smdavies99 |
Posted: Sun Mar 22, 2009 10:29 pm Post subject: |
|
|
 Jedi Council
Joined: 10 Feb 2003 Posts: 6076 Location: Somewhere over the Rainbow this side of Never-never land.
|
May I suggest that you put a trace node after the Compute node and output the Environment tree.
You are copying a tree from the input into the environment and then start messing around with a BLOB when putting it back into the output tree.
Why do you think that this is the correct way to do it? _________________ 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 |
|
 |
MQEnthu |
Posted: Sun Mar 22, 2009 11:00 pm Post subject: |
|
|
 Partisan
Joined: 06 Oct 2008 Posts: 329 Location: India
|
chenna.hari wrote: |
Here i need to store records for one condition in Environment variables so that i will assign this back to outputRoot and propagate |
Any perticular reason why do you want to store it in Environment tree before assigning it to Output tree?? And I understand that the ourtput message format remains same as input (same pipe delimited message), you just have to split the message based on the value in field 'b' but the basic message structure remains same... then why do you think you should write the output tree in blob?  _________________ -----------------------------------------------
It is good to remember the past,
but don't let past capture your future |
|
Back to top |
|
 |
chenna.hari |
Posted: Mon Mar 23, 2009 7:50 pm Post subject: |
|
|
Centurion
Joined: 21 Mar 2009 Posts: 103
|
smdavies99 wrote: |
May I suggest that you put a trace node after the Compute node and output the Environment tree.
You are copying a tree from the input into the environment and then start messing around with a BLOB when putting it back into the output tree.
Why do you think that this is the correct way to do it? |
Here i need two files to be sent to two different servers. Here i can use two while loops to form two outputRoot. But iterations will be become twice as no of records in input file.... thats why i stored records for one condition in environment variables and remaiing records in Output.
any way Iam using this logic
Environment.RecordCount.Record[RecordCount].Element1 = InputRoot.MRM.Record[RecordCount1].Element1
SET OutputRoot.MRM = Environment.RecordCount
Its worked fine...
But what was the wrong in the way which i sent previously |
|
Back to top |
|
 |
|