Space Delimited File

Archive of postings to DataStageUsers@Oliver.com. This forum intended only as a reference and cannot be posted to.

Moderators: chulett, rschirm

Locked
admin
Posts: 8720
Joined: Sun Jan 12, 2003 11:26 pm

Space Delimited File

Post by admin »

This is a topic for an orphaned message.
admin
Posts: 8720
Joined: Sun Jan 12, 2003 11:26 pm

Post by admin »

If you are working on UNIX and the middle field cannot contain a space, then
I would use the sed command on the file to remove excess spaces (multiple
spaces to single spaces between the fields), and then use 032 as the
separate value in DataStage.

Please note, the TRIM command is MUCH slower then using sed on the file
prior to DataStage processing the file... MUCH slower.

Also, if the files are small and/or you are not worried about speed, you
could take the following approach:
- Create a Stage variable in the Transformer, lets say that you called the
Stage variable
NoSpacesValues and the Derivation is: Trim(In_Field, , R)
- Lets say that you have 3 columns defined for the target and they are
called Col_1, Col_2,
and Col_3 (Hopefully you made it MUCH more descriptive...). The
derivations would be:
Col_1 would be: Field(NoSpacesValues, , 1)
Col_2 would be: Field(NoSpacesValues, , 2)
Col_3 would be: Field(NoSpacesValues, , 3)

Sincerely,

Lester


Lester F. Callif | Manager | BearingPoint, Inc. | Denver, Colorado
Mobile 303.596.8422 | Fax 707.988.0160


-----Original Message-----
From: wolfgang.huerter@gerling.de [mailto:wolfgang.huerter@gerling.de]
Sent: Tuesday, September 30, 2003 1:47 AM
To: datastage-users@oliver.com
Subject: RE: Space Demilited File


Hi Shrikanth,

use a three-step-approach:

seq-file-->TransformerStep1-->TransformerStep1-->seqfile-->......

STEP 1: read whole line as one field. Trim Space, so that you have only one
space in between: TRIM(LINE)
STEP 2: Convert Space to any delimiter: CONVERT(" ",";",LINE) and save to a
new file
STEP 3: Read this file with the delimiter (here ";")*

Wolfgang

* Anglo-Americans use mostly the comma "," as delimiter, the
rest-of-the-world-people mostly use semicolon ";"

-----Original Message-----
From: Shrikanth Ramanathan [mailto:ar_shriks@yahoo.com]
Sent: Tuesday, September 30, 2003 9:31 AM
To: datastage-users@oliver.com
Subject: Space Demilited File



I have a space delimited text file as my source
(Input). I am not sure how to define space as a
delimiter in the Format tab. For example, my data
would like like :

10 ABCD 99.99
20 EFG 100
30 XYZ 300

How do I define spaces as a delimiter in datastage? I
want to define the above data as space delimited and
view (by clicking on View Data) the data as three
columns.

Thanks & Regards
Shrikanth


__________________________________
Do you Yahoo!?
The New Yahoo! Shopping - with improved product search
http://shopping.yahoo.com



******************************************************************************
The information in this email is confidential and may be legally
privileged. Access to this email by anyone other than the
intended addressee is unauthorized. If you are not the intended
recipient of this message, any review, disclosure, copying,
distribution, retention, or any action taken or omitted to be taken
in reliance on it is prohibited and may be unlawful. If you are not
the intended recipient, please reply to or forward a copy of this
message to the sender and delete the message, any attachments,
and any copies thereof from your system.
******************************************************************************
Locked