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 » CSV with appended spaces

Post new topic  Reply to topic
 CSV with appended spaces « View previous topic :: View next topic » 
Author Message
olafbey
PostPosted: Thu Nov 01, 2007 6:20 am    Post subject: CSV with appended spaces Reply with quote

Newbie

Joined: 16 Dec 2006
Posts: 3

Hello all,

i have to develop a csv message model, where each record has a fixed length of 698 characters. This means, i have to append blanks for each record.

e.g.
"AAA","BBB","CC"<CR>
"AA","BB","CCC" <CR>
"AAAA","B","" <CR>

The development of the csv message model in the tds domain was easy, it works fine so far. But appending blanks in the tds domain seems to be impossible, because the elements are all of variable length.
Do i have to use the cwf domain with a new message definition in a second step?

Your help would be really appreciated.

Olaf
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Thu Nov 01, 2007 6:27 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

There's a CSV sample that comes with V6. It should tell you how to do this.

Also, you're not talking about "appended spaces", you're talking about NULL valued or missing elements.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
olafbey
PostPosted: Thu Nov 01, 2007 8:39 am    Post subject: Re: fixed length records with variable length elements Reply with quote

Newbie

Joined: 16 Dec 2006
Posts: 3

Hello Jeff,

thanks a lot for your quick reply. Sorry, but my explanation seems a bit inaccurate.

i have to write records in a file as csv. This works perfect, as described in the samples. Each element is delimited by commas and has a variable length, so the resulting record has a variable length too. Furthermore, some elements accept null values. up to this point everything is working fine.
The point is, the application reading the file expects a fixed record length of 698 characters. To achieve this I have to fill up the record at the end with spaces up to the total length of 698 characters.
i read the csv samples, but there is no hint or example that covers the problem as described.

Olaf
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Thu Nov 01, 2007 8:46 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

Ah, yes.

Okay.

I have a couple of thoughts on how this might be done.. but I'm not sure enough of them off the top of my head to mention. I've got some time, so lemme play with this and see.

If nothing else, I know you can do this by using ASBITSTREAM to serialize the message, and then manually padding each record by working with BLOB data.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
EddieA
PostPosted: Thu Nov 01, 2007 8:47 am    Post subject: Reply with quote

Jedi

Joined: 28 Jun 2001
Posts: 2453
Location: Los Angeles

You would have to force the output to be serialised, with ASBITSTREAM, and then add the required spaces to the resultant BLOB.

Cheers,
_________________
Eddie Atherton
IBM Certified Solution Developer - WebSphere Message Broker V6.1
IBM Certified Solution Developer - WebSphere Message Broker V7.0
Back to top
View user's profile Send private message
kimbert
PostPosted: Thu Nov 01, 2007 8:54 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

hi,

TDS can pad individual fixed length fields. If you tick 'Observe Element Length' it can even pad individual delimited fields . But it cannot pad the contents of a complex type. Unfortunately, that's what you need

You could probably do what you require like this ( not tested):

- Create a message definition 'OneLine' for a single line of delimited fields

In a loop in your Compute node
- Use ASBITSTREAM with message type 'OneLine' to create a BLOB variable
- Pad the line to the required length using ESQL
- Create LASTCHILD of OutputRoot.MRM NAME 'anything' TYPE MRM.Bitstream VALUE yourBLOB;
Back to top
View user's profile Send private message
umaneesh
PostPosted: Tue Oct 27, 2009 1:46 pm    Post subject: Re: CSV with appended spaces Reply with quote

Novice

Joined: 13 Apr 2009
Posts: 24

Hi,

I am facing the similar situation here. Need to have padding character as SPACES in CSV simple string elements. It is parsing fine but produces the same without padding.

something like this:

"aerodynamics,turbulence,6.1.0.4"

Should transform as

"aerodynamics ,turbulence ,6.1.0.4 "


I have to parse field by field, as the fixed length differs in each field.

Thanks.
Back to top
View user's profile Send private message
kimbert
PostPosted: Tue Oct 27, 2009 3:04 pm    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

Doesn't 'Observe element length' meet the requirement?
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 » CSV with appended spaces
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.