Loading from db into a squential file without deilimeter.

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
laxmi_etl
Charter Member
Charter Member
Posts: 117
Joined: Thu Sep 28, 2006 9:10 am

Loading from db into a squential file without deilimeter.

Post by laxmi_etl »

Hi-

I need to load data from database to sequential file without a deilimter, but with a fixed width for each coulum.
Like Column A takes first 1- 7 digits and Column B 8-16 , and column C is 16-30 etc..

Any thoughts , pls help.


Thanks
samsuf2002
Premium Member
Premium Member
Posts: 397
Joined: Wed Apr 12, 2006 2:28 pm
Location: Tennesse

Post by samsuf2002 »

set the delimiter in seq file as 'none'
hi sam here
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

and the sqltype as char. :wink:
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
laxmi_etl
Charter Member
Charter Member
Posts: 117
Joined: Thu Sep 28, 2006 9:10 am

Post by laxmi_etl »

any more thoughts??
talk2shaanc
Charter Member
Charter Member
Posts: 199
Joined: Tue Jan 18, 2005 2:50 am
Location: India

Post by talk2shaanc »

laxmi_etl wrote:any more thoughts??
your design should be
db2 ===> seq file

DB2 should have a normal SQL.

and your Sequential file should have below properties.
Record delimeter = UNIX newline
Record Length =fixed
Delimeter = none
Shantanu Choudhary
tagnihotri
Participant
Posts: 83
Joined: Sat Oct 28, 2006 6:25 am

Post by tagnihotri »

"and the sqltype as char" While doing this check for the paded character (i.e. default env variable) because you may end up padding your char fields with funny characters which may not be even printable.
csrazdan
Participant
Posts: 127
Joined: Wed May 12, 2004 6:03 pm
Location: Chicago IL

Re: Loading from db into a squential file without deilimeter

Post by csrazdan »

I can give you one more idea. You can use SQL statement to format data. This was the way we used to unload data from a DB table into fixed format files in good old days:

Consider a table emp:
SQL> desc emp
Name Null? Type
----------------------------------------- -------- ----------------------------
EMPID NOT NULL NUMBER(5)
FNAME VARCHAR2(15)
MNAME VARCHAR2(1)
LNAME VARCHAR2(15)
ZIP NUMBER(5)

Following sql will format the data into fixed width record.

SQL> select lpad(empid,5)||rpad(fname,15)||mname||rpad(lname,15)||lpad(zip,5) EMP_REC from emp;

If you want you can embed this SQL in datastage job to create a file.
How about that... hope it helps.
Assume everything I say or do is positive
Post Reply