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 » DFDL Parsing Issue with variable Length Record

Post new topic  Reply to topic
 DFDL Parsing Issue with variable Length Record « View previous topic :: View next topic » 
Author Message
curiousfellow
PostPosted: Thu Feb 19, 2015 9:53 am    Post subject: DFDL Parsing Issue with variable Length Record Reply with quote

Newbie

Joined: 28 Sep 2009
Posts: 1

Hi,

I'm facing an issue using DFDL in MB 8.0.0.4

We have a requirement where we receive text file with records separated by EndOfLine character. Some of the records can have varying lengths like 70,80,90 etc and what this length should be is defined in position 10-12 of that record.It can be safely assumed that content of the file is correct and no numeric validation error or anything will happen.

I thought specifying this condition in discriminator for that record type might solve the problem but if I give following expression in discriminator, looks like it can't even evaluate the expression even though that x-path is valid.

{/Records/Transaction/recordType16/rec_length) eq '70'

Looks like only relative path from the current position can be evaluated at that stage. Is that correct or I'm missing something here.

Assuming this is expected bevhaviour in DFDL, do you see any way the file can be parsed as a whole or each individual record needs to be passed separately to a model which will be defined using 'choice' only.

Please point me to any previous discussion regarding this if I've missed that.

Thanks.
Back to top
View user's profile Send private message
shanson
PostPosted: Mon Feb 23, 2015 2:15 am    Post subject: Reply with quote

Partisan

Joined: 17 Oct 2003
Posts: 344
Location: IBM Hursley

It sounds like each record has a common prefix and a variable length body? So there are two things you need to solve - the variable length, and the different records. I'd do something like this:

Code:

el=record
  choice
    el=record1
    el=record2
    ...
    el=recordN

el=record1
  sequence
    el=type
       dfdl:discriminator test="{. eq 1}"
    el=length
    el=body dfdl:lengthKind="explicit" dfdl:length="{../length}"
      sequence
        el=field11
        el=field12
        ...
        el=field1N



The discriminator expression resolves the choice, and the length expression ensures that the correct length is extracted.

If you have a large number of records, and the type is the first thing in the record, then consider treating the type as a dfdl:initiator.

The schemas on the DFDLSchemas GitHub site are good examples to follow.
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 » DFDL Parsing Issue with variable Length Record
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.