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 » Need some help parsing 'date' in CWF (parsing errors)

Post new topic  Reply to topic
 Need some help parsing 'date' in CWF (parsing errors) « View previous topic :: View next topic » 
Author Message
isaw
PostPosted: Tue Mar 31, 2009 4:42 am    Post subject: Need some help parsing 'date' in CWF (parsing errors) Reply with quote

Apprentice

Joined: 09 May 2007
Posts: 45

Hey guys.

I have a flat file of multiple records with various fields, fixed lengths. The records are parsed one by one and inserted into a Database. That's usually fine.

One of the fields in the record is a date in the 'yyyyMMdd' format, located at the end of the record just before some filler whitespace. This needs to go to the database as a date if valid, otherwise NULL is fine.

Code:
"AAAABBXXX   FF183000000000      YNYYYNYNNN 20080909 00000000          "


The value of the date field can either be a proper date like '20090331' or just zeros '00000000' if no value was set on the originating source (their way of indicating a NULL for that numeric field).

Now, I've got my MRM working with everything but that field at the moment - it throws up a bunch of exceptions leading to this :

Code:

(0x01000000):Exception = (
(0x03000000):ExceptionType     = 'ParserException' (CHARACTER)
(0x03000000):ErrorNumber       = 5540 (INTEGER)
(0x03000000):SeverityLevel     = 3 (INTEGER)
(0x03000000):ErrorSource       = '' (CHARACTER)
(0x03000000):DiagnosticMessage = 'CPI Unable to parse datetime internally' (CHARACTER)
(0x03000000):CauseOfException  = '( 00000000, yyyyMMdd, 1 )' (CHARACTER)


In my msg def, the field in question is "xsd:date" and has the following props set:

Logical Props : Local Element :
- Default checked
- Nillable checked.
- Min/Max occurance 1
Physical Properties : CWF :
- Physical Type : Fixed Length String
- Length : 8
- Length Units : Bytes
- Justification : Left
- Padding Char : '0'
- DateTime Format : yyyyMMdd
- Encoding Null : NullLiteralFill
- Encoding Null Value : 0
- rest is default

And it fails with that.

I've changed the Encoding Null to "NullLiteralValue" and tried 00000000 as the Encoding Null Value but still it didn't like it.

As a side note, I also have a field earlier on as an "xsd:time" which works fine when either "183000", "000000" or " " (6 spaces) shows up. I have that one set to NullLiteralFill/SPACE as the encoding types for that.

I just can't seem to find the right settings for a Date. Does anyone have any suggestions?
Back to top
View user's profile Send private message
isaw
PostPosted: Tue Mar 31, 2009 4:52 am    Post subject: Reply with quote

Apprentice

Joined: 09 May 2007
Posts: 45

I suppose the easiest solution is to take it as a plain string and cater for the Date possibilities in the ESQL.
Back to top
View user's profile Send private message
kimbert
PostPosted: Wed Apr 01, 2009 1:04 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

Not sure why NullLiteralValue is not working. It is definitely the correct approach You could try NullLiteralFill/'0' and see whether that does the job.
Back to top
View user's profile Send private message
mqjeff
PostPosted: Wed Apr 01, 2009 2:14 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

kimbert wrote:
Not sure why NullLiteralValue is not working. It is definitely the correct approach You could try NullLiteralFill/'0' and see whether that does the job.


So... when does MRM use NullLiteralValue/NullLiteralFill? On writing? On parsing? On both?
Back to top
View user's profile Send private message
kimbert
PostPosted: Wed Apr 01, 2009 3:36 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

Both.
Nulls have a physical (literal) representation in the bit stream, and a logical representation in the message tree ( value IS NULL ). The MRM parser maps between the two when parsing or writing, and uses the Null Handling properties to do so.
Back to top
View user's profile Send private message
isaw
PostPosted: Wed Apr 01, 2009 5:39 am    Post subject: Reply with quote

Apprentice

Joined: 09 May 2007
Posts: 45

kimbert,

NullLiteralFill / '0' worked!

I think I tried various combinations but that one didn't come up. So now it's parsing the flatfile record and reads in the '00000000' date and the resulting field is NULL as I want.

Funny - I wouldn't have expected that if it was reading it as a String. Had it been read as a numeric, all zeros technically are just '0' so a NULL would go. But i figured that '00000000' != '0' from a String point of view.

Anyhow, thanks for the help. Solved a sticking point for me and is definitely seomthing I need to keep in mind (much more parsing like this to go).

Cheers matey.


EDIT: Looking at my initial attempts, I simply had 0 and not '0' in single quotes. I suppose even tho the field was defined as xsd:date, the parsing was a 'fixed length String' so naturally was looking for the value to be in quotes, to represent a string....? And not a value without single quotes which in this case denoted a numeric...? Or am I barking up the wrong tree? Just trying to figure out my mistake.
Back to top
View user's profile Send private message
kimbert
PostPosted: Wed Apr 01, 2009 11:35 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

Your theory is probably correct, but I don't have time to investigate in detail. Glad it's working now.
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 » Need some help parsing 'date' in CWF (parsing errors)
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.