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 IndexWebSphere Message Broker SupportRemove extra comma from fixed length output using DFDL

Post new topicReply to topic
Remove extra comma from fixed length output using DFDL View previous topic :: View next topic
Author Message
akashdwolf
PostPosted: Mon Oct 15, 2018 9:51 am Post subject: Remove extra comma from fixed length output using DFDL Reply with quote

Apprentice

Joined: 09 Feb 2017
Posts: 26
Location: Mumbai

I am doing XML to Fixed Length Conversion using DFDL.
I need to create 3 lines for 3 incoming complexTypes and do padding for all the elements with a space.
I am able to do this but after every element a comma is added,I need help to remove the comma.

Below is the flow order:
HTTPInput -->Comput-->Fileoutput


Below is the esql code:

CREATE COMPUTE MODULE TEST_Compute
CREATE FUNCTION Main() RETURNS BOOLEAN
BEGIN
SET OutputRoot.DFDL = InputRoot.XMLNSC;
END;
END MODULE;

Below is the DFDL:

<?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:fn="http://www.w3.org/2005/xpath-functions" xmlns:ibmDfdlExtn="http://www.ibm.com/dfdl/extensions" xmlns:ibmSchExtn="http://www.ibm.com/schema/extensions" xmlns:recSepFieldsFmt="http://www.ibm.com/dfdl/RecordSeparatedFieldFormat">
<xsd:import namespace="http://www.ibm.com/dfdl/RecordSeparatedFieldFormat" schemaLocation="../IBMdefined/RecordSeparatedFieldFormat.xsd" />
<xsd:annotation>
<xsd:appinfo source="http://www.ogf.org/dfdl/">
<dfdl:format encoding="{$dfdl:encoding}" escapeSchemeRef="" occursCountKind="implicit" ref="recSepFieldsFmt:RecordSeparatedFieldsFormat" />
</xsd:appinfo>
</xsd:annotation>
<xsd:complexType name="Header">
<xsd:sequence dfdl:sequenceKind="ordered" dfdl:separatorPolicy="suppressedAtEndLax">
<xsd:element dfdl:length="30" dfdl:textPadKind="padChar" dfdl:lengthKind="explicit" name="Structure" type="xsd:string" />
<xsd:element dfdl:length="10" dfdl:textPadKind="padChar" dfdl:lengthKind="explicit" name="Action" type="xsd:string" />
<xsd:element dfdl:length="20" dfdl:textPadKind="padChar" dfdl:lengthKind="explicit" name="UserWhoCreated" type="xsd:string" />
<xsd:element dfdl:length="26" dfdl:textPadKind="padChar" dfdl:lengthKind="explicit" name="UserWhoCreatedTS" type="xsd:string" />
<xsd:element dfdl:length="20" dfdl:textPadKind="padChar" dfdl:lengthKind="explicit" name="UserWhoUpdated" type="xsd:string" />
<xsd:element dfdl:length="26" dfdl:textPadKind="padChar" dfdl:lengthKind="explicit" name="UserWhoUpdatedTS" type="xsd:string" />
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="Entity">
<xsd:sequence dfdl:sequenceKind="ordered">
<xsd:element dfdl:length="50" dfdl:textPadKind="padChar" dfdl:lengthKind="explicit" name="businessName" type="xsd:string" />
<xsd:element dfdl:length="50" dfdl:textPadKind="padChar" dfdl:lengthKind="explicit" name="address1" type="xsd:string" />
<xsd:element dfdl:length="50" dfdl:textPadKind="padChar" dfdl:lengthKind="explicit" name="address2" type="xsd:string" />
<xsd:element dfdl:length="40" dfdl:textPadKind="padChar" dfdl:lengthKind="explicit" name="city" type="xsd:string" />
<xsd:element dfdl:length="3" dfdl:textPadKind="padChar" dfdl:lengthKind="explicit" name="state" type="xsd:string" />
<xsd:element dfdl:length="3" dfdl:textPadKind="padChar" dfdl:lengthKind="explicit" name="country" type="xsd:string" />
<xsd:element dfdl:length="11" dfdl:textPadKind="padChar" dfdl:lengthKind="explicit" name="postalCode" type="xsd:string" />
<xsd:element dfdl:length="15" dfdl:textPadKind="padChar" dfdl:lengthKind="explicit" name="phone" type="xsd:string" />
<xsd:element dfdl:length="10" dfdl:textPadKind="padChar" dfdl:lengthKind="explicit" name="phoneExtension" type="xsd:string" />
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="PersonalDetails">
<xsd:sequence dfdl:sequenceKind="ordered">
<xsd:element dfdl:length="50" dfdl:textPadKind="padChar" dfdl:lengthKind="explicit" name="Name" type="xsd:string" />
<xsd:element dfdl:length="40" dfdl:textPadKind="padChar" dfdl:lengthKind="explicit" name="city" type="xsd:string" />
<xsd:element dfdl:length="3" dfdl:textPadKind="padChar" dfdl:lengthKind="explicit" name="state" type="xsd:string" />
<xsd:element dfdl:length="3" dfdl:textPadKind="padChar" dfdl:lengthKind="explicit" name="country" type="xsd:string" />
<xsd:element dfdl:length="11" dfdl:textPadKind="padChar" dfdl:lengthKind="explicit" name="postalCode" type="xsd:string" />
<xsd:element dfdl:length="15" dfdl:textPadKind="padChar" dfdl:lengthKind="explicit" name="phone" type="xsd:string" />
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="CustomerRequest">
<xsd:sequence dfdl:sequenceKind="ordered">
<xsd:element dfdl:terminator="%CR;%LF;" name="Header" nillable="false" type="Header" />
<xsd:element dfdl:terminator="%CR;%LF;" name="corporateEntity" nillable="false" type="Entity" maxOccurs="1" />
<xsd:element dfdl:terminator="%CR;%LF;" name="PersonalDetails" nillable="false" type="PersonalDetails" maxOccurs="unbounded" />
</xsd:sequence>
</xsd:complexType>
<xsd:element dfdl:lengthKind="implicit" ibmSchExtn:docRoot="true" name="CreateCustomerRequest" type="CustomerRequest" />
</xsd:schema>

Input Request:

<CreateCustomerRequest>
<Header>
<Structure></Structure>
<Action>CREATE</Action>
<UserWhoCreated>TEST</UserWhoCreated>
<UserWhoCreatedTS>0001-01-01-00.00.00.000000</UserWhoCreatedTS>
<UserWhoUpdated>TEST</UserWhoUpdated>
<UserWhoUpdatedTS>0001-01-01-00.00.00.000000</UserWhoUpdatedTS>
</Header>
<corporateEntity>
<businessName>Marine International</businessName>
<address1>One Marine drive</address1>
<address2>One Marine drive</address2>
<city>Fort Lauradel</city>
<state>FL</state>
<country>USA</country>
<postalCode>32111</postalCode>
<phone>101</phone>
<phoneExtension>91</phoneExtension>
</corporateEntity>
<PersonalDetails>
<Name>Marine1 International</Name>
<city>Fort Lauradel</city>
<state>FL</state>
<country>USA</country>
<postalCode>32111</postalCode>
<phone>101</phone>
</PersonalDetails>
</CreateCustomerRequest>



Current Output:
,CREATE ,TEST ,0001-01-01-00.00.00.000000,TEST ,0001-01-01-00.00.00.000000
,Marine International ,One Marine drive ,One Marine drive ,Fort Lauradel ,FL ,USA,32111 ,101 ,91
,Marine1 International ,Fort Lauradel ,FL ,USA,32111 ,101


Expected Output:
CREATE TEST 0001-01-01-00.00.00.000000TEST 0001-01-01-00.00.00.000000
Marine International One Marine drive One Marine drive Fort Lauradel FL USA32111 101 91
Marine1 International Fort Lauradel FL USA32111 101


How can I remove these commas?

Thanks in advance !!!
Back to top
View user's profile Send private message
Vitor
PostPosted: Mon Oct 15, 2018 9:56 am Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 25310
Location: Ohio, USA

How did you create the DFDL? It's importing the RecordSeparatedFieldFormat, which IIRC comes out of the CSV wizard and defaults to a comma as a separator.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
akashdwolf
PostPosted: Mon Oct 15, 2018 10:03 am Post subject: Reply with quote

Apprentice

Joined: 09 Feb 2017
Posts: 26
Location: Mumbai

Thanks for the reply Vitor,

Actually I refered the below link:

http://www.mqseries.net/phpBB/viewtopic.php?t=62156&sid=5e5950875c43f444e49cbdef5045583c

Let me know if you find anything wrong,I am not very experienced with DFDL.
Back to top
View user's profile Send private message
akashdwolf
PostPosted: Mon Oct 15, 2018 10:06 am Post subject: Reply with quote

Apprentice

Joined: 09 Feb 2017
Posts: 26
Location: Mumbai

Actally I refered smuktineni's post from that link but I did not use COBOL.
Back to top
View user's profile Send private message
Vitor
PostPosted: Mon Oct 15, 2018 10:25 am Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 25310
Location: Ohio, USA

akashdwolf wrote:
Actally I refered smuktineni's post from that link but I did not use COBOL.


OK, but that doesn't really say anything about what you did, just that you read the post first.

So:

- did you use one of the wizards; if so which one?
- if you used record oriented text (and if you didn't, I've found your problem) what setting did you select?

Let's start there.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
timber
PostPosted: Mon Oct 15, 2018 10:41 am Post subject: Reply with quote

Sentinel

Joined: 25 Aug 2015
Posts: 868

As Vitor pointed out, this line:
Code:
<xsd:import namespace="http://www.ibm.com/dfdl/RecordSeparatedFieldFormat" schemaLocation="../IBMdefined/RecordSeparatedFieldFormat.xsd" />
...is importing a set of DFDL properties designed for delimited formats. Your format is not delimited - it's a fixed-length format.

If I was modelling this I would probably not bother to import any default format. DFDL will tell you (via errors) when you haven't set a mandatory property. Fix the errors until DFDL stops reporting them, and you'll be good to go.
Back to top
View user's profile Send private message
akashdwolf
PostPosted: Mon Oct 15, 2018 10:49 am Post subject: Reply with quote

Apprentice

Joined: 09 Feb 2017
Posts: 26
Location: Mumbai

Thanks Vitor for replying,

I followed the below steps:

New Message Model-->Record-oriented Text-->Create an emptyDFDL schema file,I will model my data using DFDL schema editor

Below DFDL was created along with default IBM XSD RecordSeparatedFieldFormat.xsd:

<?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:fn="http://www.w3.org/2005/xpath-functions" xmlns:ibmDfdlExtn="http://www.ibm.com/dfdl/extensions" xmlns:ibmSchExtn="http://www.ibm.com/schema/extensions" xmlns:recSepFieldsFmt="http://www.ibm.com/dfdl/RecordSeparatedFieldFormat">
<xsd:import namespace="http://www.ibm.com/dfdl/RecordSeparatedFieldFormat" schemaLocation="../IBMdefined/RecordSeparatedFieldFormat.xsd" />
<xsd:annotation>
<xsd:appinfo source="http://www.ogf.org/dfdl/">
<dfdl:format encoding="{$dfdl:encoding}" escapeSchemeRef="" occursCountKind="implicit" ref="recSepFieldsFmt:RecordSeparatedFieldsFormat" />
</xsd:appinfo>
</xsd:annotation>
</xsd:schema>

After this I manually pasted the schema.


Last edited by akashdwolf on Mon Oct 15, 2018 11:24 am; edited 1 time in total
Back to top
View user's profile Send private message
Vitor
PostPosted: Mon Oct 15, 2018 10:50 am Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 25310
Location: Ohio, USA

timber wrote:
As Vitor pointed out, this line:
Code:
<xsd:import namespace="http://www.ibm.com/dfdl/RecordSeparatedFieldFormat" schemaLocation="../IBMdefined/RecordSeparatedFieldFormat.xsd" />
...is importing a set of DFDL properties designed for delimited formats. Your format is not delimited - it's a fixed-length format.


I was hoping for a "Doh!" moment when the OP realizes there's a radio button he missed (well that's how I duplicated his problem.......)

timber wrote:
If I was modelling this I would probably not bother to import any default format. DFDL will tell you (via errors) when you haven't set a mandatory property. Fix the errors until DFDL stops reporting them, and you'll be good to go.




It's a nice simple format and I doubt using a wizard would be that much faster.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
Vitor
PostPosted: Mon Oct 15, 2018 10:52 am Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 25310
Location: Ohio, USA

akashdwolf wrote:

Below DFDL was created along with default IBM XSD RecordSeparatedFieldFormat.xsd:


A record separated field format will not work for your fixed length data. If your data is not fixed length but is space delimited, then you need to set that up.

akashdwolf wrote:
After this I manually pasted the schema.


Having cut it from where?
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
Vitor
PostPosted: Mon Oct 15, 2018 10:55 am Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 25310
Location: Ohio, USA

If it was me, and it isn't, I'd go with @timber's suggestion.

Start again with a blank schema.

Don't import any of the IBM schemas unless you're sure you need them (tip: you don't).

Model the types and the messages.

Bask in the triumph.

This will be much faster than trying to fix what you have.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
akashdwolf
PostPosted: Mon Oct 15, 2018 12:43 pm Post subject: Reply with quote

Apprentice

Joined: 09 Feb 2017
Posts: 26
Location: Mumbai

Thanks timber and Vitor.
I made the suggested changes and its working now.
Back to top
View user's profile Send private message
Display posts from previous:
Post new topicReply to topic Page 1 of 1

MQSeries.net Forum IndexWebSphere Message Broker SupportRemove extra comma from fixed length output using DFDL
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.