Import from fixed length file

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

dxk9
Participant
Posts: 105
Joined: Wed Aug 19, 2009 12:46 am
Location: Chennai, Tamil Nadu

Post by dxk9 »

ray.wurlod wrote:Use Record Delimiter String = DOS Format, not Record Delimiter = UNIX newline (because your server is on Windows). ...
I used the above settings also, but couldn't view it. I get the same error

"record_length=fixed" (no length given) and record field format is variable-length. The first variable-length field is "REC_TYPE".


Regards,
Divya
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Lose Record Length = Fixed from the properties. We have already pointed out that you do not have fixed length format.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
dxk9
Participant
Posts: 105
Joined: Wed Aug 19, 2009 12:46 am
Location: Chennai, Tamil Nadu

Post by dxk9 »

Hi,

My sample file is something like this.

Header
CASDC142585654DAFSD74586KDJMEN
CASDC142585655DAFSD74586KDJMEN
CASDC142585656DAFSD74586KDJMEN
CASDC142585657DAFSD74586KDJMEN
CASDC142585658DAFSD74586KDJMEN
CASDC142585659DAFSD74586KDJMEN
CASDC142585660DAFSD74586KDJMEN
CASDC142585661DAFSD74586KDJMEN
CASDC142585662DAFSD74586KDJMEN
CASDC142585663DAFSD74586KDJMEN
CASDC142585664DAFSD74586KDJMEN

Can anybody try importing it and let me know the settings. I am trying this for more than a week, but not able to view. Dont know where exactly I am going wrong.

Regards,
Divya
laknar
Participant
Posts: 162
Joined: Thu Apr 26, 2007 5:59 am
Location: Chennai

Post by laknar »

Set First Line is Column Name=True.

Record Length = Fixed

Record Delimiter = UNIX New Line.

CASDC142585654DAFSD74586KDJMEN
CASDC142585655DAFSD74586KDJMEN
CASDC142585656DAFSD74586KDJMEN
CASDC142585657DAFSD74586KDJMEN
CASDC142585658DAFSD74586KDJMEN
CASDC142585659DAFSD74586KDJMEN
CASDC142585660DAFSD74586KDJMEN
CASDC142585661DAFSD74586KDJMEN
CASDC142585662DAFSD74586KDJMEN
CASDC142585663DAFSD74586KDJMEN
CASDC142585664DAFSD74586KDJMEN

How Many columns Contains In this File.

Define the exact length for each column or import the sequence file definitions.
Please Search the forum you will get lot of answers for this
dxk9
Participant
Posts: 105
Joined: Wed Aug 19, 2009 12:46 am
Location: Chennai, Tamil Nadu

Post by dxk9 »

There are 5 fields with length 5, 9, 5, 5, 6 respectively.

I got many replies from forum, but I am still not able to view the data.

Regards,
Divya
laknar
Participant
Posts: 162
Joined: Thu Apr 26, 2007 5:59 am
Location: Chennai

Post by laknar »

what is length for the header.

Header length should same as Other Records length.
try import through sequential file definitions.
dxk9
Participant
Posts: 105
Joined: Wed Aug 19, 2009 12:46 am
Location: Chennai, Tamil Nadu

Post by dxk9 »

The header length was not same as the other records, so I removed the header. Now my file has the following data.

CASDC142585654DAFSD74586KDJMEN
CASDC142585655DAFSD74586KDJMEN
CASDC142585656DAFSD74586KDJMEN
CASDC142585657DAFSD74586KDJMEN
CASDC142585658DAFSD74586KDJMEN
CASDC142585659DAFSD74586KDJMEN
CASDC142585660DAFSD74586KDJMEN
CASDC142585661DAFSD74586KDJMEN
CASDC142585662DAFSD74586KDJMEN
CASDC142585663DAFSD74586KDJMEN
CASDC142585664DAFSD74586KDJMEN

I used the sequential file import to import the format and i specified the field lengths in it. (5,9,5,5,6).. I was also able to view the data in the define tab of the importer.

But when I specify the same lengths for the fields, datatype=char, record length = fixed, final delimiter = end. I get the following error

"record_length=fixed" (no length given) and record field format is variable-length. The first variable-length field is "REC_TYPE".

What does "record field format " means??

Regards,
Divya
laknar
Participant
Posts: 162
Joined: Thu Apr 26, 2007 5:59 am
Location: Chennai

Post by laknar »

As Ray adviced If you specify the Datatype = Char
we shoud not specify this option record length = fixed.since char is fixed length datatype.

Just define final delimiter = end.

and remove the delimiter property.i.e Delimiter=Comma
dxk9
Participant
Posts: 105
Joined: Wed Aug 19, 2009 12:46 am
Location: Chennai, Tamil Nadu

Post by dxk9 »

I tried that also, but when i remove the record length=fixed option, I get the error as

"Field "REC_TYPE" lacks whitespace delimiter, at offset: 5"

I just wonder if it is so difficult to work with Fixed length file!!

Regards,
Divya
laknar
Participant
Posts: 162
Joined: Thu Apr 26, 2007 5:59 am
Location: Chennai

Post by laknar »

i can see There is no record type field in your file.

Usually REC_TYPE is one byte.
Modify the file accordingly.Define in Columns tab Char=1
dxk9
Participant
Posts: 105
Joined: Wed Aug 19, 2009 12:46 am
Location: Chennai, Tamil Nadu

Post by dxk9 »

The default delimiter is whitespace, So when I set the delimiter = none, its working now.

Now I should try with my original file which contains lot of spaces between the fields in addition to the data.

Will get back with my issues with the original file, Hope I dont have any :)

Thanks a lot of of you for help!! Thanks laknar for your timely help!!

Regards,
Divya
dxk9
Participant
Posts: 105
Joined: Wed Aug 19, 2009 12:46 am
Location: Chennai, Tamil Nadu

Post by dxk9 »

I am able to view my original file too :D

Now I have another doubt,

My actual file contains data of various record types,

For eg.

Lets assume it contains records of 2 record types(each fixed length), the field lengths are

rowtype 1(1st character in file):5, 9, 5, 5, 6
rowtype 2(1st character in file):5, 8, 6, 5, 6, 3

What I did was, I imported the actual file as a single field and the filtered each record type to various files and then I am using those target files as input in different DS jobs.

I am jus curious to know if there is any other way to import the actual file itself. I heard it can be done via complex file, but not sure how to do it.

Any help???

Regards,
Divya
laknar
Participant
Posts: 162
Joined: Thu Apr 26, 2007 5:59 am
Location: Chennai

Post by laknar »

Try the schema Definitions.

Enable the multiple instance invoke the same job for Various file formats.
Store the schema file infile systems.invoke the schema file through parameter.
dxk9
Participant
Posts: 105
Joined: Wed Aug 19, 2009 12:46 am
Location: Chennai, Tamil Nadu

Post by dxk9 »

laknar wrote:Try the schema Definitions.

Enable the multiple instance invoke the same job for Various file formats.
Store the schema file infile systems.invoke the schema file through parameter.

I don't understand :(

Can you give me more explanation.

Thanks,
Divya
dxk9
Participant
Posts: 105
Joined: Wed Aug 19, 2009 12:46 am
Location: Chennai, Tamil Nadu

Post by dxk9 »

dxk9 wrote:I am able to view my original file too :D

Now I have another doubt,

My actual file contains data of various record types,

For eg.

Lets assume it contains records of 2 record types(each fixed length), the field lengths are

rowtype 1(1st character in file):5, 9, 5, 5, 6
rowtype 2(1st character in file):5, 8, 6, 5, 6, 3

What I did was, I imported the actual file as a single field and the filtered each record type to various files and then I am using those target files as input in different DS jobs.

I am jus curious to know if there is any other way to import the actual file itself. I heard it can be done via complex file, but not sure how to do it.

Any help???

Regards,
Divya
My sample file would be:

1CASDC142585654DAFSD74586KDJMEN
2CASDC142585655DAFSD74586KDJMEN001
1CASDC142585656DAFSD74586KDJMEN
1CASDC142585657DAFSD74586KDJMEN
2CASDC142585658DAFSD74586KDJMEN002
2CASDC142585659DAFSD74586KDJMEN003
1CASDC142585660DAFSD74586KDJMEN
1CASDC142585661DAFSD74586KDJMEN
2CASDC142585662DAFSD74586KDJMEN004
2CASDC142585663DAFSD74586KDJMEN005
1CASDC142585664DAFSD74586KDJMEN

Regards,
Divya
Post Reply