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
Loading from db into a squential file without deilimeter.
Moderators: chulett, rschirm, roy
-
- Premium Member
- Posts: 397
- Joined: Wed Apr 12, 2006 2:28 pm
- Location: Tennesse
-
- Charter Member
- Posts: 199
- Joined: Tue Jan 18, 2005 2:50 am
- Location: India
-
- Participant
- Posts: 83
- Joined: Sat Oct 28, 2006 6:25 am
Re: Loading from db into a squential file without deilimeter
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.
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