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 SupportIssue while escaping special character in DFDL parser

Post new topicReply to topic
Issue while escaping special character in DFDL parser View previous topic :: View next topic
Author Message
rahulk01
PostPosted: Fri Sep 18, 2020 4:19 am Post subject: Issue while escaping special character in DFDL parser Reply with quote

Apprentice

Joined: 26 Dec 2019
Posts: 35

Hi,

I have a requirement where I am trying to set % in a text field, something like below:
SET rBelopRecord.RESERVASJONNR = 'O' || '%';

But after being validated by the DFDL parser in the output message, it appears as "O%.
How do I make this " go away from the output message being generated.
Back to top
View user's profile Send private message
rahulk01
PostPosted: Fri Sep 18, 2020 4:33 am Post subject: Reply with quote

Apprentice

Joined: 26 Dec 2019
Posts: 35

So far I have tried escaping % in the following manner:
'%%'
'"%'
'"%"'
but nothing seems to work, everytime it just adds " before the entire text
Back to top
View user's profile Send private message
rahulk01
PostPosted: Fri Sep 18, 2020 5:38 am Post subject: Reply with quote

Apprentice

Joined: 26 Dec 2019
Posts: 35

providing more information:

the escape scheme in my DFDL definition is as below:
<dfdl:defineEscapeScheme name="RecordEscapeScheme">
<dfdl:escapeScheme escapeKind="escapeBlock" escapeBlockStart='"' escapeBlockEnd='"' escapeCharacter='"'
escapeEscapeCharacter='"' extraEscapedCharacters='%#x0D; %#x0A;' generateEscapeBlock="whenNeeded"></dfdl:escapeScheme>
</dfdl:defineEscapeScheme>

I even tried setting the escapeKind to escapeCharacter and used the esql statement:
SET rBelopRecord.IDENTIFIER9 = 'O' || '"%'; and in another occasion as
SET rBelopRecord.IDENTIFIER9 = 'O' || '""%';

but none worked
Back to top
View user's profile Send private message
timber
PostPosted: Fri Sep 18, 2020 2:04 pm Post subject: Reply with quote

Grand Master

Joined: 25 Aug 2015
Posts: 1138

Thanks for the clear problem description - we appreciate it when people tell us what they have already tried. It saves our time as well as yours.

I can definitely help you with this, but first I will need the following information:
- what type of data format are you trying to write? ( you have only quoted the escape scheme, so I know nothing at all about the rest of the DFDL schema)
- You said that the output appears as "O%. Surely you mean "O%" because escapeKind is set to 'escapeBlock' which will start and end the entire field value with the escape character.
- Do you have any need for escaping at all? If so, what are the requirements for escaping of delimiters?
Back to top
View user's profile Send private message
rahulk01
PostPosted: Sun Sep 20, 2020 9:43 pm Post subject: Reply with quote

Apprentice

Joined: 26 Dec 2019
Posts: 35

timber wrote:
Thanks for the clear problem description - we appreciate it when people tell us what they have already tried. It saves our time as well as yours.

I can definitely help you with this, but first I will need the following information:
- what type of data format are you trying to write? ( you have only quoted the escape scheme, so I know nothing at all about the rest of the DFDL schema)
- You said that the output appears as "O%. Surely you mean "O%" because escapeKind is set to 'escapeBlock' which will start and end the entire field value with the escape character.
- Do you have any need for escaping at all? If so, what are the requirements for escaping of delimiters?



I see your point here. The escape schemes were set be default when I created the DFDL parser, so I did not touch them.
I have created a DFDL parser to send feed to a mainframe application (whose copybook we never got). This application uses % and * as their field separators, so I needed my DFDL parser to understand % and * as just literals, so escaping their special meaning was required.
I tried removing the entire escapeScheme and that has solved my problem.
You are correct, I do not need escaping at all, so have removed them.
Back to top
View user's profile Send private message
timber
PostPosted: Mon Sep 21, 2020 3:18 am Post subject: Reply with quote

Grand Master

Joined: 25 Aug 2015
Posts: 1138

Quote:
This application uses % and * as their field separators
Are these fields variable-length? If so, please pick one of the following options:
a) the characters % and * can never, ever appear in the value of any of these fields.
b) there is a chance that % and * might appear in at least one of these fields, sometimes.
Back to top
View user's profile Send private message
rahulk01
PostPosted: Mon Sep 21, 2020 3:23 am Post subject: Reply with quote

Apprentice

Joined: 26 Dec 2019
Posts: 35

timber wrote:
Quote:
This application uses % and * as their field separators
Are these fields variable-length? If so, please pick one of the following options:
a) the characters % and * can never, ever appear in the value of any of these fields.
b) there is a chance that % and * might appear in at least one of these fields, sometimes.


Option b is valid in this scenario.
Back to top
View user's profile Send private message
timber
PostPosted: Mon Sep 21, 2020 5:34 am Post subject: Reply with quote

Grand Master

Joined: 25 Aug 2015
Posts: 1138

If the delimiters can appear within the data then you definitely do require an escape scheme. Your current solution is not safe. It only appears to work correctly because your are not testing with data values that include % and *.

You cannot just invent an escape scheme, though. You will need to speak to the team that owns the mainframe application. The mainframe app will probably be expecting a particular escape character to be used. When they have answered that question, you can set up a custom escape scheme as described here:

https://www.ibm.com/support/knowledgecenter/en/SSMKHH_9.0.0/com.ibm.etools.mft.doc/df00110_.htm

Probably, you will need to set escapeKind='escapeCharacter', not 'escapeBlock'
Back to top
View user's profile Send private message
rahulk01
PostPosted: Mon Sep 21, 2020 5:50 am Post subject: Reply with quote

Apprentice

Joined: 26 Dec 2019
Posts: 35

timber wrote:
If the delimiters can appear within the data then you definitely do require an escape scheme. Your current solution is not safe. It only appears to work correctly because your are not testing with data values that include % and *.

You cannot just invent an escape scheme, though. You will need to speak to the team that owns the mainframe application. The mainframe app will probably be expecting a particular escape character to be used. When they have answered that question, you can set up a custom escape scheme as described here:

https://www.ibm.com/support/knowledgecenter/en/SSMKHH_9.0.0/com.ibm.etools.mft.doc/df00110_.htm

Probably, you will need to set escapeKind='escapeCharacter', not 'escapeBlock'


Well what has been done so far is, the delimiter is defined at each element level in the DFDL. % is not going to come as a part of the data (confirmed). * can be a part of the data, but thankfully only in those elements whose delimiter is not * (but rather %).
So I guess, removing the escape scheme should be a safe option.
Back to top
View user's profile Send private message
timber
PostPosted: Mon Sep 21, 2020 7:03 am Post subject: Reply with quote

Grand Master

Joined: 25 Aug 2015
Posts: 1138

Quote:
So I guess, removing the escape scheme should be a safe option
Thanks for clarifying - I agree with that.
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 SupportIssue while escaping special character in DFDL parser
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.