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 » Date format conversion from Input CSV file and output to csv

Post new topic  Reply to topic
 Date format conversion from Input CSV file and output to csv « View previous topic :: View next topic » 
Author Message
MQ_user1
PostPosted: Wed Jul 23, 2014 6:05 am    Post subject: Date format conversion from Input CSV file and output to csv Reply with quote

Novice

Joined: 09 Jun 2010
Posts: 19

Hi

I need help on converting "DateTime" field in a csv file to different Date format as one field and Time format in another field to a csv file.

Input CSV file contains:
xxx,123,456,23-07-2014 15.00.00

Output CSV file format should be:
xxx,123,456,20140723,1500

I have prepared 2 XSD Message model files and validated taking 4th column as String.

Note: Input CSV files reside on remote server and output csv files should be placed on another remote server. I was able to pick the files and place in remote server but missing the logic here.

Now, I'm struck on how to go forward......whether to write an ESQL or use Message Map.

I'm new to Message Broker development.

Thanks
ARaj
Back to top
View user's profile Send private message
mqjeff
PostPosted: Wed Jul 23, 2014 6:30 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

it doesn't matter how you map between the fields, as long as the model indicates that they are timestamps and each model has the appopriate format information.

This kind of formatting is "physical" information. inside your message flow, you only ever deal with "logical" information.
Back to top
View user's profile Send private message
MQ_user1
PostPosted: Wed Jul 23, 2014 6:37 am    Post subject: Reply with quote

Novice

Joined: 09 Jun 2010
Posts: 19

Hi Mqjeff,

I didn't understand what you said.

In both Message models I have used it as String....If I use substring function to map to 4th and 5th column on output csv.....then how can Field4 which is actually Date in Text format can be converted to different format?

Here, we have 2 things:
1. To Split Column4 to 2 columns
2. Convert 1st part of Column4 to different Date format.


Please tell me in detail.


Thanks
ARaj
Back to top
View user's profile Send private message
mqjeff
PostPosted: Wed Jul 23, 2014 6:42 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

No, you should model the CSV files using the DFDL csv templates.

Then you don't worry about "columns", you worry about logical fields.

Then model the input and output fields as datetime, and then you set the first output field to output only the date and the second output field to output only the time.
Back to top
View user's profile Send private message
MQ_user1
PostPosted: Wed Jul 23, 2014 7:53 am    Post subject: Reply with quote

Novice

Joined: 09 Jun 2010
Posts: 19

I'm struggling to Model Input CSV where I can able to validate when column4 is defined as String but when I set it as DateTime then I have below errors.


23 Jul 2014 17:52:21 info: Offset: 15. Found delimited value: '23-07-2014 15.00.00' for element 'field4'. The delimiter was '%CR;%LF;%WSP*;'.
[dfdl = /MessageModellingLibrary/Kasse.xsd, scd = #xscd(/schemaElement::Kasse/type::0/model::sequence/schemaElement::record/type::0/model::sequence/schemaElement::field4), 123]

23 Jul 2014 17:52:21 error: CTDP3029E: Invalid calendar value '23-07-2014 15.00.00' for element 'field4'. Parsing failed at offset 13.

23 Jul 2014 17:52:21 fatal: CTDP3029E: Invalid calendar value '23-07-2014 15.00.00' for element 'field4'. Parsing failed at offset 13.

Thanks
ARaj
Back to top
View user's profile Send private message
Vitor
PostPosted: Wed Jul 23, 2014 8:00 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

MQ_user1 wrote:
I'm struggling to Model Input CSV where I can able to validate when column4 is defined as String but when I set it as DateTime then I have below errors.


Is that string an out of the box date time format?

Is there anything you could do to provide DFDL with the information it needs to interpret that as a date time?
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
MQ_user1
PostPosted: Wed Jul 23, 2014 8:04 am    Post subject: Reply with quote

Novice

Joined: 09 Jun 2010
Posts: 19

Yes Vitor,

Its a String from Input CSV file as below

Input CSV file contains:
xxx,123,456,23-07-2014 15.00.00

Output CSV file format should be:
xxx,123,456,20140723,1500


In Input CSV message model I'm defining 4th Column as "dateTime".

Thanks
ARaj
Back to top
View user's profile Send private message
mqjeff
PostPosted: Wed Jul 23, 2014 8:15 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

So it found the value, and it extracted the piece it needed.

It then tried to parse it using the physical format information contained in the model.

This information *did not* match the field. That is, it tried to parse "23-07-2014 15.00.00" using the wrong format.

So alter the format of the datetime. In the Model.
Back to top
View user's profile Send private message
Vitor
PostPosted: Wed Jul 23, 2014 9:20 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

MQ_user1 wrote:
Its a String from Input CSV file as below


Yes, I understand that.

MQ_user1 wrote:
In Input CSV message model I'm defining 4th Column as "dateTime".


My point is:

Does that string format match what the DFDL parser expects when you say "dateTime"? Or is it just a string that, to the human eye, is a date time but to the parser might as well be the opening chapter of Romeo & Juliet? Such that you might have to explain to the DFDL parser that it is, in fact a dateTime and what makes it so?
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
kimbert
PostPosted: Wed Jul 23, 2014 2:39 pm    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

Open the DFDL xsd in the DFDL editor.
Select the dateTime element
In the DFDL properties, find the 'Calendar Pattern' property and alter it.
_________________
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
MQ_user1
PostPosted: Thu Jul 24, 2014 8:39 am    Post subject: Reply with quote

Novice

Joined: 09 Jun 2010
Posts: 19

Hi All,

It worked after making changes said by kimbert and also updating file input node properties as DFDL parser as I'm using File input node to fetch the files from remote server.

Thanks All.
ARaj
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 » Date format conversion from Input CSV file and output to csv
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.