| Author | 
		  Message
		 | 
		
		  | mqbrks | 
		  
		    
			  
				 Posted: Thu May 04, 2017 8:32 am    Post subject: Data for DFDL xsd | 
				     | 
			   
			 
		   | 
		
		
		   Voyager
 
 Joined: 17 Jan 2012 Posts: 75
  
  | 
		  
		    
			  
				Hi All,
 
 
I am trying to prepare a file for the xsd(dfdl) and require help to fix the data.
 
This is my xsd 
 
   
	| Code: | 
   
  
	<?xml version="1.0" encoding="UTF-8"?><xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:dfdl="http://www.ogf.org/dfdl/dfdl-1.0/" xmlns:fmt="http://www.ibm.com/dfdl/RecordFixLengthFieldFormat" xmlns:ibmDfdlExtn="http://www.ibm.com/dfdl/extensions" xmlns:ibmSchExtn="http://www.ibm.com/schema/extensions" xmlns:ref="http://www.ibm.com/dfdl/RecordSeparatedFieldFormat">
 
<xsd:import namespace="http://www.ibm.com/dfdl/RecordSeparatedFieldFormat" schemaLocation="../IBMdefined/RecordSeparatedFieldFormat.xsd"/>
 
<xsd:import namespace="http://www.ibm.com/dfdl/RecordFixLengthFieldFormat" schemaLocation="../IBMdefined/RecordFixLengthFieldFormat.xsd"/>
 
<xsd:complexType name="EmployeesInfo_909">
 
<xsd:sequence dfdl:terminator="$$$">
 
<xsd:element dfdl:lengthKind="delimited" dfdl:occursCountKind="implicit" dfdl:terminator="~^" minOccurs="0" name="FileName" type="xsd:string"/>
 
<xsd:element dfdl:initiator="" dfdl:lengthKind="implicit" dfdl:occursCountKind="implicit" maxOccurs="unbounded" name="EmployeeInfo">
 
<xsd:complexType>
 
<xsd:sequence dfdl:terminator="&">
 
<xsd:element dfdl:lengthKind="delimited" dfdl:terminator="|" name="Company" type="xsd:string"/>
 
<xsd:element dfdl:lengthKind="delimited" dfdl:terminator="|" name="RegistrationId" type="xsd:string"/>
 
<xsd:element dfdl:lengthKind="delimited" dfdl:terminator="|" name="PersonName" type="xsd:string"/>
 
<xsd:element dfdl:lengthKind="delimited" name="PersonInfo">
 
<xsd:complexType>
 
<xsd:sequence dfdl:separatorSuppressionPolicy="trailingEmpty" dfdl:terminator="|">
 
<xsd:element dfdl:length="45" dfdl:lengthKind="explicit" dfdl:lengthUnits="characters" name="Name" type="xsd:string"/>
 
<xsd:element dfdl:length="45" dfdl:lengthKind="explicit" dfdl:lengthUnits="characters" name="Type" type="xsd:string"/>
 
</xsd:sequence>
 
</xsd:complexType>
 
</xsd:element>
 
<xsd:element dfdl:lengthKind="delimited" dfdl:terminator="|" name="Address" type="xsd:string"/>
 
<xsd:element dfdl:lengthKind="delimited" dfdl:terminator="|" name="City" type="xsd:string"/>
 
<xsd:element dfdl:lengthKind="delimited" dfdl:terminator="|" name="State" type="xsd:string"/>
 
<xsd:element dfdl:lengthKind="delimited" dfdl:terminator="|" name="MotherName" type="xsd:string"/>
 
<xsd:element dfdl:lengthKind="delimited" dfdl:terminator="|" name="FatherName" type="xsd:string"/>
 
<xsd:element dfdl:length="1" dfdl:lengthKind="explicit" dfdl:lengthUnits="characters" name="EndOfRecord" type="xsd:string"/>
 
</xsd:sequence>
 
</xsd:complexType>
 
</xsd:element>
 
</xsd:sequence>
 
</xsd:complexType>
 
<xsd:element dfdl:lengthKind="implicit" dfdl:occursCountKind="implicit" ibmSchExtn:docRoot="true" name="EmployeesInfo_909" type="EmployeesInfo_909"/>
 
<xsd:annotation>
 
<xsd:appinfo source="http://www.ogf.org/dfdl/">
 
<dfdl:format byteOrder="{$dfdl:byteOrder}" documentFinalTerminatorCanBeMissing="yes" encoding="{$dfdl:encoding}" escapeSchemeRef="fmt:RecordEscapeScheme" ref="fmt:RecordFixLengthFieldsFormat" separatorSuppressionPolicy="anyEmpty"/>
 
</xsd:appinfo>
 
</xsd:annotation>
 
</xsd:schema> | 
   
 
 
 
And this data is parsed successfully
 
 
   
	| Quote: | 
   
  
	| ABCD_05042017_0189808000_V~^IBM|1008909|Mike|Mike                                         |Male                                        |Chicago IL|Moline|IL|Ginger|Michael|a&$$$ | 
   
 
 
 
where as this data, if I have two employeeinfo records, the parsing fails.
 
   
	| Quote: | 
   
  
	| ABCD_05042017_0189808000_V~^IBM|1008909|Mike|Mike                                         |Male                                        |Chicago IL|Moline|IL|Ginger|Michael|a&IBM|1008909|Mike|Mike                                         |Male                                        |Chicago IL|Moline|IL|Ginger|Michael|a$$$ | 
   
 
 
 
is there something wrong with the way the data is prepared?
 
 
Your inputs pls? | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | mqjeff | 
		  
		    
			  
				 Posted: Thu May 04, 2017 8:38 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Grand Master
 
 Joined: 25 Jun 2008 Posts: 17447
  
  | 
		  
		    
			  
				Create a sequence terminated by $$.
 
Create a repeating record in that sequence terminated by $. _________________ chmod  -R ugo-wx / | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | mqbrks | 
		  
		    
			  
				 Posted: Thu May 04, 2017 9:09 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Voyager
 
 Joined: 17 Jan 2012 Posts: 75
  
  | 
		  
		    
			  
				
   
	| mqjeff wrote: | 
   
  
	Create a sequence terminated by $$.
 
Create a repeating record in that sequence terminated by $. | 
   
 
 
 
yup this is the one right I have shown above in my post? 
 
 
Quote: 
 
ABCD_05042017_0189808000_V~^IBM|1008909|Mike|Mike |Male |Chicago IL|Moline|IL|Ginger|Michael|a&IBM|1008909|Mike|Mike |Male |Chicago IL|Moline|IL|Ginger|Michael|a$$$
 
 
but its failing. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | mqjeff | 
		  
		    
			  
				 Posted: Thu May 04, 2017 9:13 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Grand Master
 
 Joined: 25 Jun 2008 Posts: 17447
  
  | 
		  
		    
			  
				
   
	| mqbrks wrote: | 
   
  
	
   
	| mqjeff wrote: | 
   
  
	Create a sequence terminated by $$.
 
Create a repeating record in that sequence terminated by $. | 
   
 
 
 
yup this is the one right I have shown above in my post?  | 
   
 
 
 
Yes, taking time to read through the DFDL xsd does seem to show that. 
 
 
   
	| mqbrks wrote: | 
   
  
	| but its failing. | 
   
 
 
 
Well.  There's your problem.
 
 
Start with "what does 'it's failing' mean"
 
 
Then go on to figure out "What does the data (error message, trace, etc.) tell me about the failure". _________________ chmod  -R ugo-wx / | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | mqbrks | 
		  
		    
			  
				 Posted: Thu May 04, 2017 9:27 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Voyager
 
 Joined: 17 Jan 2012 Posts: 75
  
  | 
		  
		    
			  
				
   
	| mqjeff wrote: | 
   
  
	
 
Start with "what does 'it's failing' mean"
 
 
Then go on to figure out "What does the data (error message, trace, etc.) tell me about the failure". | 
   
 
 
 
May 4, 2017, 1:23:01 PM	fatal: CTDP3061E: Terminator '$$$' not found at offset '174'  for sequence or choice within element  '/EmployeesInfo_909[1]'.
 
 
And if I include the terminator $$$ at the end and prepare the data this way 
 
Data 
 
   
	| Quote: | 
   
  
	| ABCD_05042017_0189808000_V~^IBM|1008909|Mike|Mike                                         |Male                                        |Chicago IL|Moline|IL|Ginger|Michael|a&$$$IBM|1008909|Mike|Mike                                         |Male                                        |Chicago IL|Moline|IL|Ginger|Michael|a | 
   
 
 
 
   
	| Quote: | 
   
  
	| May 4, 2017, 1:24:41 PM	fatal: CTDP3002E: Unexpected data found at offset '177' after parsing completed. Data: '0x49...'. | 
   
 
[/quote]
 
 
Basically it doesn't allow me to have two "EmployeeInfo" records. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | mqjeff | 
		  
		    
			  
				 Posted: Thu May 04, 2017 9:29 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Grand Master
 
 Joined: 25 Jun 2008 Posts: 17447
  
  | 
		  
		    
			  
				Oh.
 
 
Your terminator is "$$$".
 
 
Your terminator on the employee record is $.  So you need the terminator on the sequence to be $$, not $$$
 
 
Two, not Three.  The end of your last employee record will be a $. _________________ chmod  -R ugo-wx / | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | mqbrks | 
		  
		    
			  
				 Posted: Thu May 04, 2017 9:42 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Voyager
 
 Joined: 17 Jan 2012 Posts: 75
  
  | 
		  
		    
			  
				
   
	| mqjeff wrote: | 
   
  
	Oh.
 
 
Your terminator is "$$$".
 
 
Your terminator on the employee record is $.  So you need the terminator on the sequence to be $$, not $$$
 
 
Two, not Three.  The end of your last employee record will be a $. | 
   
 
 
 
Thanks a lot...that worked!    | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | 
		    
		   |