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 » CSV DFDL with multiple 'Header' elements

Post new topic  Reply to topic
 CSV DFDL with multiple 'Header' elements « View previous topic :: View next topic » 
Author Message
LiamDuffield
PostPosted: Fri Jun 05, 2015 6:49 am    Post subject: CSV DFDL with multiple 'Header' elements Reply with quote

Newbie

Joined: 14 Mar 2014
Posts: 7

Hi Guys,

I'm trying to create a DFDL schema to accept multiple 'Header' elements and multiple 'Records', almost like multiple CSVs in a single file.

Example:

Code:
HeaderF1(STATIC CHAR),HeaderF2,HeaderF3
RecordF1,RecordF2,RecordF3,RecordF4,RecordF5
RecordF1,RecordF2,RecordF3,RecordF4,RecordF5

HeaderF1(STATIC CHAR),HeaderF2,HeaderF3
RecordF1,RecordF2,RecordF3,RecordF4,RecordF5
RecordF1,RecordF2,RecordF3,RecordF4,RecordF5

HeaderF1(STATIC CHAR),HeaderF2,HeaderF3
RecordF1,RecordF2,RecordF3,RecordF4,RecordF5
RecordF1,RecordF2,RecordF3,RecordF4,RecordF5
RecordF1,RecordF2,RecordF3,RecordF4,RecordF5
RecordF1,RecordF2,RecordF3,RecordF4,RecordF5

HeaderF1(STATIC CHAR),HeaderF2,HeaderF3
RecordF1,RecordF2,RecordF3,RecordF4,RecordF5
RecordF1,RecordF2,RecordF3,RecordF4,RecordF5


(Line breaks added to improve readability)

Annoyingly there are an unknown amount of Record elements per Header element.

I've tried creating a record DFDL, with unbounded Header element and defining the Header initiator as the static char but this produces a single header with the other Headers/Records entered as records.

I can loop around this in ESQL but want to be a bit more elegant and use DFDL to it's fullest.

Any nods towards any help would be much appreciated.[/code]
Back to top
View user's profile Send private message
mqjeff
PostPosted: Fri Jun 05, 2015 6:55 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

You need to be able to discriminate between a header and a detail record.

You then need to put both of them into a repeating type, and have a single header followed by a repeating set of records.
Back to top
View user's profile Send private message
kimbert
PostPosted: Fri Jun 05, 2015 12:02 pm    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

mqjeff is spot-on.
Code:
Message
    RecordGroup maxOccurs="unbounded"
        Header minOccurs=1 maxOccurs=1
        Record maxOccurs="unbounded"
How will the DFDL parser know when a RecordGroup has f inished?
Answer : You have to design a discriminator for the Record element which returns false when it is trying to parse a Header. The DFDL parser will then back out of parsing the Record and try to parse another RecordGroup.
_________________
Before you criticize someone, walk a mile in their shoes. That way you're a mile away, and you have their shoes too.
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 » CSV DFDL with multiple 'Header' elements
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.