cancel
Showing results for 
Search instead for 
Did you mean: 

Complex File Content Conversion - with random multiple occurrences

former_member211899
Participant
0 Kudos

Hi Experts,

I have this scenario with a complex file content conversion, where there are multiple occurrences of a single tag... in random fashion.... Pls refer the file below:

:20:6420018743768419

:25:3000/100000010

:28C:1/1

:34F:EURC0,00

:34F:EURD0,00

:13D:1005100000+0100

:61:1005080510C0,02NMSCNONREF//AC40225384 0

:86:BOEKING OMSCHRIJVING

:86:BOEKING OMSCHRIJVING

:86:BOEKING OMSCHRIJVING

:61:1005080510D0,01NMSCNONREF//PA01005084104580

:86:BOEKING OMSCHRIJVING

:86:BOEKING OMSCHRIJVING

:61:1005080510D0,01NMSCNONREF//PA01005084104590

:86:BOEKING OMSCHRIJVING

:90C:EUR0,03

:90D:EUR0,03

I have given the tags like :20: as the key field value and tried to read the file... Also gave the keepIncompleteFields tag for each parameter since the length of the field is not always the same as provided in the specification.

The Adapter is reading the file well... but only upto tag :61:

The issue here is that :61: tag is not occuring continously... it is randomly occuring between the :86: tag... If it had occured continously... then by giving the corresponding XML field as unbounded, I am able to generate multiple nodes of this field... ( like in tag :34F: )

Also the functional logic is that :61: is the Transaction and :86: is the Information related to the transaction.

It has been specified in the Functional Spec that for each :61: tag, there can be upto 6 occurrences of the :86: tag... Issue number two is that even if the File is read into the XML form, how can we realize the mapping by selecting the exact number of :86: tags belonging to each :61: tag

Please check and provide a solution.... Thanks in advance

Regards,

Krishna

Edited by: Krishna _XI on Mar 8, 2011 1:27 AM

Accepted Solutions (1)

Accepted Solutions (1)

baskar_gopalakrishnan2
Active Contributor
0 Kudos

Krishna,

Have you checked this blog that refers random pattern in the file content.

/people/anish.abraham2/blog/2005/06/08/content-conversion-patternrandom-content-in-input-file

Answers (4)

Answers (4)

former_member211899
Participant
0 Kudos

Hi Stefan,

Your earlier answer has bailed me out....

Just out of curiousity, I checked the Recordset Sequence and gave the option as Variable

Guess what... the FCC seems to work exactly according to my expectation....

The input file and the converted XML have been given below

INPUT FILE

:942:

:20:6420018743768419

:25:3000/100000010

:28C:1/1

:34F:EURC0,00

:34F:EURD0,00

:13D:1005100000+0100

:61:1005080510C0,02NMSCNONREF//AC40225384 0

:86:BOEKING OMSCHRIJVING

:86:BOEKING OMSCHRIJVING

:86:BOEKING OMSCHRIJVING

:86:BOEKING OMSCHRIJVING

:61:1005080510D0,01NMSCNONREF//PA01005084104580

:86:BOEKING OMSCHRIJVING

:86:BOEKING OMSCHRIJVING

:86:BOEKING OMSCHRIJVING

:61:1005080510D0,01NMSCNONREF//PA01005084104590

:86:BOEKING OMSCHRIJVING

:90D:EUR0,03

:90C:EUR0,03

-


CONVERTED XML MESSAGE

<MT942>

<Ref_number>

<Key>:20:</Key>

<Value>6420018743768419</Value>

</Ref_number>

<Account_no>

<Key>:25:</Key>

<Value>3000/100000010</Value>

</Account_no>

<Statement_number>

<Key>:28C:</Key>

<Value>1/1</Value>

</Statement_number>

<Indicator>

<Key>:34F:</Key>

<Value>EURC0,00</Value>

</Indicator>

<Indicator>

<Key>:34F:</Key>

<Value>EURD0,00</Value>

</Indicator>

<Date_Time_Stamp>

<Key>:13D:</Key>

<Value>1005100000+0100</Value>

</Date_Time_Stamp>

<Statement_Line> <Key>:61:</Key> <Value>1005080510C0,02NMSCNONREF//AC40225384 0</Value> </Statement_Line>

<Information> <Key>:86:</Key> <Value>BOEKING OMSCHRIJVING</Value> </Information> <Information> <Key>:86:</Key> <Value>BOEKING OMSCHRIJVING</Value> </Information> <Information> <Key>:86:</Key> <Value>BOEKING OMSCHRIJVING</Value> </Information> <Information> <Key>:86:</Key> <Value>BOEKING OMSCHRIJVING</Value> </Information>

<Statement_Line> <Key>:61:</Key> <Value>1005080510D0,01NMSCNONREF//PA01005084104580</Value> </Statement_Line>

<Information> <Key>:86:</Key> <Value>BOEKING OMSCHRIJVING</Value> </Information> <Information> <Key>:86:</Key> <Value>BOEKING OMSCHRIJVING</Value> </Information> <Information> <Key>:86:</Key> <Value>BOEKING OMSCHRIJVING</Value> </Information>

<Statement_Line> <Key>:61:</Key> <Value>1005080510D0,01NMSCNONREF//PA01005084104590</Value> </Statement_Line>

<Information> <Key>:86:</Key> <Value>BOEKING OMSCHRIJVING</Value> </Information>

<Debits>

<Key>:90D:</Key>

<Value>EUR0,03</Value>

</Debits>

<Credits>

<Key>:90C:</Key>

<Value>EUR0,03</Value>

</Credits>

</MT942>

<MT942>

<Ref_number>

<Key>:20:</Key>

<Value>6420018743768419</Value>

</Ref_number>

<Account_no>

<Key>:25:</Key>

<Value>3000/100000010</Value>

</Account_no>

<Statement_number>

<Key>:28C:</Key>

<Value>1/1</Value>

</Statement_number>

<Indicator>

<Key>:34F:</Key>

<Value>EURC0,00</Value>

</Indicator>

<Indicator>

<Key>:34F:</Key>

<Value>EURD0,00</Value>

</Indicator>

<Date_Time_Stamp>

<Key>:13D:</Key>

<Value>1005100000+0100</Value>

</Date_Time_Stamp>

<Statement_Line>

<Key>:61:</Key>

<Value>1005080510C0,02NMSCNONREF//AC40225384 0</Value>

</Statement_Line>

<Information>

<Key>:86:</Key>

<Value>BOEKING OMSCHRIJVING</Value>

</Information>

<Statement_Line>

<Key>:61:</Key>

<Value>1005080510D0,01NMSCNONREF//PA01005084104580</Value>

</Statement_Line>

<Information>

<Key>:86:</Key>

<Value>BOEKING OMSCHRIJVING</Value>

</Information>

<Statement_Line>

<Key>:61:</Key>

<Value>1005080510D0,01NMSCNONREF//PA01005084104590</Value>

</Statement_Line>

<Information>

<Key>:86:</Key>

<Value>BOEKING OMSCHRIJVING</Value>

</Information>

<Statement_Line>

<Key>:61:</Key>

<Value>1005100510D0,01NMSCNONREF//PA01005104268450</Value>

</Statement_Line>

<Information>

<Key>:86:</Key>

<Value>BOEKING OMSCHRIJVING</Value>

</Information>

<Statement_Line>

<Key>:61:</Key>

<Value>1005100510C0,01NMSCNONREF//AC90228459 0</Value>

</Statement_Line>

<Information>

<Key>:86:</Key>

<Value>BOEKING OMSCHRIJVING</Value>

</Information>

<Debits>

<Key>:90D:</Key>

<Value>EUR0,03</Value>

</Debits>

<Credits>

<Key>:90C:</Key>

<Value>EUR0,03</Value>

</Credits>

</MT942>

The first Statement Line ( :61: ) has 4 tags of Information (:86:), the second one has 3 and last one has 1... and the XML is created in a similar fashion....

Regards,

Krishna

Edited by: Krishna _XI on Mar 8, 2011 4:42 PM

stefan_grube
Active Contributor
0 Kudos

The problem is that the graphical mapping tool identifies the nodes always by their context, not by their order.

All infomation nodes belong to the same context, so you cannot identify which statement belongs to it.

former_member211899
Participant
0 Kudos

Hi Stefan,

I guess I would try writing an UDF which takes the entire Recordset as an input and take the list of all child nodes. Would try to use a counter to insert a context change whenever there is a change from Information to Statement Line

Let me try doing this and hope this works out

Thank you for your valuable comments

Regards,

Krishna

former_member211899
Participant
0 Kudos

Hi Experts,

There has been more complexity added to my input file :(.... it seems i have to change my FCC again...

the :61: tag has fields coming in two lines.... eg

:61: ABCD0001234567

90144653XYZ

and the :86: tag can have values in upto six lines.... say

:86: Info1

Info2

Info3

Info4

Info5

Info6

In this case what parameters can be given to read such a file and parse it ?

Regards,

Krishna

former_member211899
Participant
0 Kudos

Hi Stefan,

Thanks for the reply.

The Recordset Sequence has already been set to ascending. The example that I gave is one Recordset... this Recordset does repeat multiple times in the same pattern in one file... but the number of :61: and :86: tags will differ in each recordset based on the transaction functionality.

Recordset Structure : Ref_number,1,Account_no,1,Statement_number,1,Indicator,,Date_Time_Stamp,1,Statement_Line,,Information,*,Debits,1,Credits,1

Recordset Sequence : Ascending

Regards,

Krishna

Edited by: Krishna _XI on Mar 8, 2011 3:21 PM

stefan_grube
Active Contributor
0 Kudos

I think you need a Java mapping.

You can either create a flat XML structure with FCC and use Java mapping to create hierarchical structure,

or crete the whole XML structure with Java mapping direct from plain text.

I do not know a way to solve this with graphical mapping as this works does not allow alternating nodes in same hierarchy level.

stefan_grube
Active Contributor
0 Kudos

set parameter "Recordset Sequence" to ascending.

This will create a record tag after each 86 block like this:

record

61

86

86

86

record

61

86

so you can group the 61 and 86 together when they are in the same context.

former_member211899
Participant
0 Kudos

Hi Baskar,

Thanks for the link.

But the link says multiple occurrences of body within hbatch and tbatch.... so it can be grouped together if you give the occurence of body as * in the Recordset Structure.

For my scenario :61: and :86: are occuring alternaltively, but i have to group them as one.

:61: Denotes Transaction and :86: denotes Information.

i.e, a converted XML of the sample file i provided should ideally look as follows:

<Reference>

<Key> :20: </Key>

<Value>6420018743768419</Value>

</Reference>

<Account>

<Key>:25:</Key>

<Value>3000/100000010</Value>

</Account>

....

....

....

<Transaction>

<Key>:61:</Key>

<Value>1005080510C0,02NMSCNONREF//AC40225384 0</Value>

</Transaction>

<Information>

<Key>:86:</Key>

<Value>BOEKING OMSCHRIJVING</Value>

</Information>

<Information>

<Key>:86:</Key>

<Value>BOEKING OMSCHRIJVING</Value>

</Information>

<Information>

<Key>:86:</Key>

<Value>BOEKING OMSCHRIJVING</Value>

</Information>

<Transaction>

<Key>:61:</Key>

<Value>1005080510D0,01NMSCNONREF//PA01005084104580</Value>

</Transaction>

<Information>

<Key>:86:</Key>

<Value>BOEKING OMSCHRIJVING</Value>

</Information>

<Information>

<Key>:86:</Key>

<Value>BOEKING OMSCHRIJVING</Value>

</Information>

<Transaction>

.....

.....

Regards,

Krishna

Edited by: Krishna _XI on Mar 8, 2011 11:11 AM

Former Member
0 Kudos

Hi Krishna,

I think you will be needing a structre like this:



Reference  :  0..1
->Key
->Value

Account  :  0..1
->Key
->Value
.....
.....
.....
Node   :  0..n
   Transaction  :  0..1
     ->Key
     ->Value
   Information   : 0..n
     ->Key
     ->Valu

But for the above structure you cannot do the standard File content convertion. I think you will have to go for custom adapter module.

Regards,

Aravind