Question: writting schema for a complicated flat file

Home Page Forums BizTalk 2004 – BizTalk 2010 Question: writting schema for a complicated flat file

Viewing 1 reply thread
  • Author
    Posts
    • #14317

      I’m using BizTalk server 2006 try to parse a flat file which contains
      different type of records and each type have different formats.

      Rows started by \”M\”, have different formats like \”01\”,\”02\”,\”03\” and each format has different kind of fileds.

      Rows started by \”T\”, have different types like \”P\”, \”T\”, \”L\”, each has different formats like \”01\”,\”02\”,\”03\”, and each format has different kind of fileds.

      seems not easy to do it by using \”define record from file instance\”, since not every line has the same structure, and some tag identifiers are in the middle of the rows~

      can anybody help on how to create a schema for it?

      <here is what the flat file looks like>
      ————–
      Header
      M,E17570850BP,01,E,175,70850,-03890.54,+0.00,+0.00,+0.00,+0.00,
      M,E17570850BP,02,+0.00,-3890.54,-3890.54,+0.00,-3890.54,+0.00,
      M,E17570850BP,03,+0.00,+0.00,-3890.54,+0.00,+0.00,+00.00,
      T,P,5K22 CECO0,01,E,175,70850,04,HG , ,+0.00,F,200512,
      T,P,5K22 CECO0,02,+195.90,195.90,10VAL,F1,6, , ,USD,
      T,P,5K22 CECO0,03,JAN 06 CMX HG , ,NCD0000006C,
      T,P,5K22 B77I0,01,E,175,70850,04,HG ,20060112,
      T,P,5K22 B77I0,02,+196.20,196.20,10VAL,F1,6, , ,USD,
      T,P,5K22 B77I0,03,JAN 06 CMX HG , ,NCD0000006C,
      T,T,5L23 BCMU0,01,E,175,70850,02,48 , ,+0.00,F,200606,
      T,T,5L23 BCMU0,02,+86.45, 86.45 ,10VAL,F1, , USD, ,
      T,T,5L23 BCMU0,03,JUN 06 CME CATTLE ,B480000006F, ,
      M,E71767240F1,01,E,717,67240,F1,USD,+2251576.27,+517337.70,+0.00,+0.00,+0.00,
      M,E71767240F1,02,+0.00,+2768913.97,+2768913.97,+631175.97,+3153725.03,-31137.94,
      M,E71767240F1,03,+2137738.00,+1586224.00,+631175.97,+0.00,+0.00,+0.00,
      T,P,5L13 J280,01,E,717,67240,14,CD , ,+0.00,F,200601,
      T,P,5L13 J280,02,+732.20,732.20,C0VAL,F1,6, , ,USD,
      T,P,5L13 J280,03,MAR 06 LDN COFFEE RO, ,NAO0000006C,
      T,T,5L23 HF00,01,E,717,67240,14,CD , ,+0.00,F,200603,
      T,T,5L23 HF00,02,+1169.00, 1169.00 ,C0LTA,F2,6, , ,
      T,T,5L23 HF00,03,MAR 06 LDN COFFEE RO, ,NAO0000006C,
      T,L,5K18 JF10,01,E,717,67240,19,GL , ,+0.00,F,200601,20051108,+532.50,1,+1.00, , ,20051108,
      T,L,5K18 JF10,02,+532.50, 532.50 ,C0LTA,F2, , , ,USD,US,0.00,F,N,Y,100.00, , ,USD, ,
      T,L,5K18 JF10,03, , , ,AEJT, ,
      Footer
      —————————————-

      Thanks~~

    • #14318

      Do you have something set as optional?

      I think you might need another level in-between the top level root and your records. That would allow you to define the records as 1 to 1 and a 1 to many on the top level. Set this new level as Choice. Something like this:

      Root
      — Data (1 to Many) CHOICE
      — Record (TYP) (1 to 1)
      — Record (ENV) (1 to 1)

      Also, make sure you test through a Send / Receive Port. Testing through Visual Stuidios can sometimes give errors that the FF Disassembler will not – at least in pre-SP1 this was the case.

      • #14319

        The key to your parsing problem is to use the <choice> group for the M, TP, TT and TL records
        e.g.
        [code:1:66d0362576]M Record
        Prefix field
        <choice>
        01 Record
        Fields…
        02 Record
        Fields…
        03 Record
        Fields…
        [/code:1:66d0362576]

        If you send me an email I can send you a schema that will parse the example flat file you have provided

        • #14320

          I am encountering the same problem. I am working on Biztalk server 2004, converting a flat file into an XML file. The text file looks as follow:

          TYP01VR 4565 SETE
          ENV01HG 134 SYDNEY
          ENV04VT 467 TAMPA
          TYP01GT 4657 NEW YORK
          ENV02NP 47 MIAMI

          In the schema I created l have one root, delimited and unbounded, and two children \”TYP\” \”ENV\” which are positional allowing me to write the length of each element.
          If I write ENV as unbounded, then everything that follows the first ENV will be added in it and the following child TYP won’t be created.

          Is there a way I can continue to create the TYP child?

Viewing 1 reply thread
  • The forum ‘BizTalk 2004 – BizTalk 2010’ is closed to new topics and replies.